: This article mainly introduces the open-source php api project. if you are interested in the PHP Tutorial, refer to it. As a phper, I have never written any decent php stuff.
Share The demo source code of an api. This demo simultaneously accesses two databases
Developed based on php5.5. 5.3 is probably not supported.
Refer to some mainstream mvc frameworks and then remove v based on your own ideas. No single entry file is used.
Composer loads class files
Monolog open source code
1. cache: cache folder. by default, the field data of the database is cached.
2. config: configure the folder.
3. controller: Although it is called a controller, it contains multiple entry files.
4. core: core code.
5. lang: validation error message template.
6. model: model.
7. vendor: composer
Not perfect
1. character set filtering and anti-injection are not performed. (As long as the field length is reasonably defined, the pdo driver has its own anti-injection function. The most important thing is that I did not write this because I did not understand it. I hope I can write it later)
2. Only one pdo driver is written. (There are many ready-made interfaces on the Internet, which can be used directly after modification. this is much more perfect than self-written interfaces .)
3. I didn't do a complete log system, because I think the common use of log system is error and warning. (I defined a variety of different exceptions to throw, receive them in the entry file, and then write logs. As shown below)
try { ...} catch (AppException $e) { ...} catch (Exception $e) { ...}
4. there are many other functions, that is, they do not take into account or can not, or even do not understand the writing.
I didn't talk much about the nonsense. I directly wrote the code, and I made a lot of comments in the code:
Http://pan.baidu.com/s/1sjV4cc1
'). AddClass ('pre-numbering '). hide (); $ (this ). addClass ('Has-numbering '). parent (). append ($ numbering); for (I = 1; I <= lines; I ++) {$ numbering. append ($ ('
'). Text (I) ;}; $ numbering. fadeIn (1700) ;}) ;}; script
The above introduces the open-source PHP api project, including some content, and hopes to help those who are interested in the PHP Tutorial.