Noframe at Oschina Escrow address: Https://git.oschina.net/yii153/noFrame
Noframe at GitHub Escrow address: Https://github.com/yii153/noFrame
The current structure of noframe is as follows
|-databases the database directory, which can contain only database classes, and all classes except the database class are implemented as a "reference only"
|-database.class.php The database connection class, the linked database in the application only needs to refer to the class and create an object of that class "for reference only"
|-database.interface.php Database interface, defines the method to be implemented by the database class "for reference only"
|-mysql.class.php Mysql Database class, you need to implement databases interface "for reference only"
|-sqlserver.class.php SQL Server database class, you need to implement databases interface "for reference only"
|-example Sample Catalog "for reference only"
The |-system.class.php System class provides welcome information, version information, sample warehousing, and query examples. Information can be obtained directly from the $webroot/entrance.php/example/system/$method call "for reference only"
|-utils Tool Catalog "for reference only"
The |-util.class.php tool class, which provides the successful execution of the request, failed the request execution, succeeded the request and returned the data. can refer to the Util class and pass util:: $method call "for reference only"
|--license LICENSE File
|--readme.md README File
|--entrance.php Portal File "core file"
Note: the "for reference only" section can be modified or deleted according to the actual project needs.
Noframe implements a single entry, class auto-loading, global class mapping (any common method that can be mapped to any class in any directory through a single portal, not limited to directories and hierarchies), Noframe provides pathinfo mode and compatibility mode for two entry modes, Noframe Default global turn on Session,noframe with error handling. Noframe does not need to install any additional expansion and environment deployment, just copy to Noframe to your Web root directory to use. Also, all of these features are implemented through a single file.
Noframe with entrance.php (entry file) as the core file. By simply copying the file to the app root, you can quickly develop an application based on MVC, single entry, and class Auto-onboarding.
Noframe based on the PSR-0 specification, class files must not have other execution code except classes, all classes use namespaces, namespaces are consistent with the absolute path of the class, the class name and path name are capitalized, and all classes are automatically loaded.
The following is an example of calling the $method method of the $class class under an unknown directory
namespace $Folder _a\ $Folder _b\folder_c\...\ $Folder _z; The namespace is consistent with the path to the file
Use $Folder _d\ $Folder _e\folder_f\...\ $IncludeClass; Referencing a class file under another directory
Use $Folder _g\ $Folder _h\folder_i\...\ $IncludeStaticClass; Referencing static class files in other directories
Class $Class Creating classes
{
Public Function $method () Create public method
{
$IC = new $IncludeClass (); To create an object that references a class
$IC $method (); method to invoke the object
$IncludeStaticClass:: $method (); Calling a method that references a static class
}
}
The server environment that supports PathInfo is called with the following address
entrance.php/$Folder _a/$Folder _b/folder_c/.../$Folder _z/$Class/$method
The server environment call address that does not support PathInfo is as follows
entrance.php $Folder _a/$Folder _b/folder_c/.../$Folder _z/$Class/$method
The difference between the PathInfo mode and the compatibility mode is only the difference between the/and after the entrance.php.
Noframe for the response of the request to make the following agreement, specific can refer to example under the System.class.php, of course, you can adjust or modify the agreement according to the actual situation.
1. Return information must be a JSON string
2. The return information must contain the message that the request was successfully processed for true/False
3. If the request processing succeeds, the error message must be included.
4. When the request is completed, the response information is turned into a JSON object, and if the request processing succeeds, the error message is printed and returned. Otherwise print success information or parse data
Service-side Example//controller/test/test
try{
Do some thing ...
Util::echo_success ();
}catch (Exception $e) {
Util::echo_error ($e->getmessage ());
}
Client Example//entrance.php/controller/test/test
if (!response.success) {
alert (response.message);
Return
}
Alert (' success ');
What problems or bugs can be reported to me during use in order to correct them in time