Nowadays, many friends like to use ThinkPHP, but some friends don’t like the many directories it generates. Here I will share with you how to put all the directories into the include directory, which is much cleaner.
The effect is as shown in the figure Shown:
Entry file
<?php // 应用入口文件 // 检测PHP环境 if(version_compare(PHP_VERSION,'5.3.0','<')) die('require PHP > 5.3.0 !'); // 网站文件入口位置 define('ABSPATH', dirname(__FILE__) . '/'); // 定义应用目录 define('APP_NAME', 'WEBSITE'); define('APP_PATH','./include/'); define('CONF_PATH', ABSPATH . '/config/'); define('RUNTIME_PATH', ABSPATH . '/cache/'); define('TMPL_PATH', ABSPATH . '/templates/'); define('UPLOAD_PATH', ABSPATH . '/uploads/'); define('THINK_PATH', APP_PATH . '/ThinkPHP/'); // 开启调试模式 define('APP_DEBUG',True); // 引入ThinkPHP入口文件 require THINK_PATH . 'ThinkPHP.php';
Configuration file
<?php return array ( 'DEFAULT_MODULE' => 'APP', 'URL_MODEL' => '2', 'TMPL_PARSE_STRING'=> array( '__PUBLIC__' => __ROOT__.'/static', '__UPLOAD__' => __ROOT__.'/uploads' ), 'TMPL_FILE_DEPR' => '_', );
Related recommendations:
Thinkphp passed How does an entry file distinguish the mobile terminal and PC terminal
How does the thinkphp project customize the WeChat sharing description content
The above is the detailed content of How to set up a custom directory structure in ThinkPHP. For more information, please follow other related articles on the PHP Chinese website!