งานนำเสนอเรื่อง: "PHP FRAMEWORK 030523315 – Web Programming and Web Database Asst. Prof. Dr. Choopan Rattanapoka."— ใบสำเนางานนำเสนอ:
PHP FRAMEWORK – Web Programming and Web Database Asst. Prof. Dr. Choopan Rattanapoka
What is a PHP Framework PHP frameworks streamline the the development of web applications written in PHP by providing a basic structure for which to build the web applications. In other words, PHP frameworks help to promote rapid application development (RAD), which saves you time, helps build more stable applications, and reduces the amount of repetitive coding for developers. Frameworks can also help beginners to build more stable apps by ensuring proper database interaction and coding on the presentation layer. This allows you to spend more time creating the actual web application, instead of spending time writing repetitive code The general idea behind the workings of a PHP framework is referred to as Model View Controller (MVC)
Why should we use a PHP Framework Developers should utilize PHP frameworks for various reasons. Speeding up the development process. Stability. PHP Framework 2013
ตัวอย่าง : CodeIgniter Framework The index.php serves as the front controller, initializing the base resources needed to run CodeIgniter. The Router examines the HTTP request to determine what should be done with it. If a cache file exists, it is sent directly to the browser, bypassing the normal system execution. Security. Before the application controller is loaded, the HTTP request and any user submitted data is filtered for security. The Controller loads the model, core libraries, helpers, and any other resources needed to process the specific request. The finalized View is rendered then sent to the web browser to be seen. If caching is enabled, the view is cached first so that on subsequent requests it can be served.
Controller ( ปกติจะเก็บใน folder: Controller) You have created a class named Pages, with a view method that accepts one argument named $page. The Pages class is extending the CI_Controller class. This means that the new pages class can access the methods and variables defined in the CI_Controller class (system/core/Controller.php)