首页
开发手册
应用中心
工具
用户中心
Notes on writing a model
English
中文简体
English
上一篇
下一篇
###Notes on writing a model FoundPHP's model is mainly the logic layer, through the development of thinking logic to execute the results, do not need to write too many algorithms, you can write general or complex algorithms in the function of the same directory. For example, to develop the cart module, we need to create a directory: plugin/model/**cart** At the same time, the system will automatically load the function library.: plugin/function/**cart.php** In this way, the calculation method or general method we write can be placed in cart.php, and the system will automatically call it without including. Model folder and file naming convention: | Types | Specification | Description | | ------------ | ------------ | ------------ | | model directory | a-z0-9_ | use lowercase letters, numbers, and underscores | | action under model | a-z0-9_ | The executable file uses lowercase letters, numbers and underscores. | **Action file description:** For example, we visit the website. http://foundphp.com/?m=article&id=123 The corresponding system modules and operations are: model:plugin/model/article action:default.php `It should be noted here that the defaults without a operation in the system connection are default.php.` http://foundphp.com/?m=article&a=search&id=123 The corresponding system modules and operations are: model:plugin/model/article action:search.php `It should be noted here that the a operation is search corresponding to plugin/model/article/search.php.`