Seeing someone in discussing the event driver problem of PHP, this should reply to a post. However, it is not enough to respond not to attract everyone's attention. Event Drive This concept is broad. You can also be on the client side. On a web application, the client's event is based on the JS or plugin or the Javaapplet. Basically, if it is a plugin or javaapplet, it is not a category of HTML, and truly must use JS. There are not many, the most is the basic operation of the Form's submission or the link. Therefore, it is not much sense to talk about the event. The true meaning of the event driver is not visualized, but it is like OO. The event driver is actually an extension of OO, and its initial prototype is a message mechanism. However, the event driver packages the message into a callable function, some of which are similar to the callback function in the API, you can define the content executed by these functions. The visual programming is independent of these functions, defining the parameters (mostly the ready-made object), let you write code and use these parameters (actually use these objects) to do something. Therefore, PHP has event drives is completely possible, mainly in the design of the framework. To make a so-called visual event driver such as VB, you must have a set of integrated development environments, including page design, event coding, and a series of functions such as compiling transcripts. In fact, the event driver like Net Net is just a commonly used web element or control, such as buttons, and text boxes, let you have a visual interface, you can design it, after it compiles, Still is the text like just turned your event code to JS or server-side code. The PHP is mainly due to the lack of IDE, and there is no precompiled mechanism, so the final submitted code is still the final PHP code, not point NET's resource code and the mixture of event code (generally in line with an XML specification ASP document, Contains non-standard HTML code). Therefore, this PHP can not reach the narrow so-called event driver programming in your mind, but it can be completely no problem. If you are interested, you may wish to go to the official homepage of www.php.net to see a set of event-driven PHP framework Prado, which is written by qiang xue. This is also the best, strongly recommended! Please refer to http://www.zend.com/php5/contest, you will understand what PHP's event driver is going on after reading his source code. But I think, on this, because PHP has no pre-compilation mechanism, and excessive dependence on OO (although it is written by PHP5), it is a bit large, and the use is more complicated, and scalability is not very good. However, the concept is very good, some ideas have solved the problem of confuse me. I will briefly introduce this framework below. The framework is written in ZDE and PHP5. There are detailed documents, the structure is very clear, the annotation is extremely easy, the code is very easy to read, indicating that the author's write code is very high. The author clearly states that this framework refers to the concept of ASP Point Net and Borland Delphi.
This framework is very strong in verification (not something that has any verification login, which is very robust, almost impossible to have any direct vulnerability can attack from the outside, it is introduced into the specification file. Concept. Restrictions, effectively solved the efficiency bottleneck when a large number of verification is solved. This verification method is only one problem is that the standard of the specification of the document itself is relatively laborious (of course, the tool is another thing), but once it is do it! There are formats and specifications), and verification is naturally made by the frame, without having to call each time. Its event can also be defined within the specification file (I think this is not necessary), in fact, its specification file is a bit similar to Delphi or the FORM definition file in VB, just use XML written plain text. Not visualization. For event drivers, the framework has a set of basic event streams similar to point NET, you can customize these events at different stages, in fact, it is to redefine these onxxx functions, use a given form of parameters, you also You can join your own events. For example, when you define your own components, you can define event functions and parameters that you may have in the specification file. You can directly define these permitted functions when you use this component. I think this way is too complicated, and to read and analyze XML files in a large number. Although it is very strict, it is very safe, but some are too much, and I have not fully utilized the flexibility of PHP itself. My idea is similar to Delphi. The function handle assigns the value or the feature of the callback function with C, you can define an event at any time at any time when writing code, and it can still clarify the event sender and type and have sufficient security guarantee without mechanical. It is very convenient to enforce all components. Code modification and extension is very convenient. Of course, when doing big projects, strict definitions are necessary, but even if so, the method of the framework is still an old board. Its template I think is a better idea, its template has some ASP files similar to point NET in the compiler (I am not familiar with the ASP point NET, but understand some principle), but the way it works. Similar to Delphi's FORM file is a good concept. The only disadvantage is that the general editor you have obtained by DW is not very embarrassed, because a template can simultaneously put several mutual exclusive components Play together, but only what is shown during the running process. As far as I personally look at the code of the frame, it is still found that it has some very weak items. One of the most important one is the problem of the path, the scalability is very low, should be applied to a dedicated host, and there is no power for some restricted hosts (directory restrictions or permission limits), and there is no corresponding reminder measures (nor related interface). It uses a path to certain resources or files, with a cumbersome mechanism called AssetService, the purpose is to determine the path path, the author also said that if you use this service, the system consumption will increase significantly, in fact, this is a borrowed The concept of Asset Library in Flash, which can be arbitrarily specified by any specified path, but every time you have to re-verify, some will not pay. My approach is to fix several major paths, and their sub-directory can be casual, and combine the contradiction between the two. Due to the lack of path problems, the framework is caused by unobstructed language settings, personalized templates, etc., if you want to translate a project, the procedures are complicated, and the workload is ideally known, and it is very easy to make mistakes. This is the most serious problem in the framework.
In general, the idea of this framework is designed, and the code is absolutely first-class. Of course, there is always, but it doesn't expect our research and study it. Its code I didn't look at it. I only have to read several core procedures and some explanations, but they have been able to see their structures and thoughts, and they have deeply admired the author, but in the shortcomings of them. Anyway, it is definitely a good work for studying the PHP event drive code. So strongly recommend! ----------------
Add up, PRADO project home page: http://www.xisc.com
Prado's author also made a reply from this theme post, more discussion, you can see the theme post of Chinaunix: http://bbs.chinaUnix.net/forum/viewtopic.php? P = 2967726
In fact, we want to recommend the author to provide Chinese documents and information.