Thinkphp was recently learned, but the process was certainly not a crash. after a day or two, I finally felt a little bit :):
I initialize the directory structure of my project:
------/Www/
----------/Www.myapp.com/
-------------------------/MyAdmin/<! -- Project background -->
/Thinkphp/<! -- TP folder -->
/Index. php <! -- Front-end portal file -->
/Admin. php <! -- Background portal file -->
/MyApp/<! -- Project front-end -->
The focus is on the configuration of MyApp. The principle of myamin is the same as that of MyApp.
I don't want to put the public folder in the root directory as on the official website. I want an application to be public, that is, for MyApp, my public path is like this:
/Www/www.myapp.com/myapp/public/
The configuration of/www/www.myapp.com/index.php is as follows:
View code
<? PHP // define ('app _ debug', true); define ('thank _ path ','. /thinkphp/'); define ('app _ path ','. /MyApp/'); define ('app _ name', 'myapp'); require (thank_path. 'thinkphp. PHP ');?>
The configuration of/www/www.myapp.com/myapp/index.php is as follows:
View code
<? PHP // define the project name and path define ('app _ name', 'myapp'); define ('app _ path ','. /'); // load the framework entry file require (".. /thinkphp. PHP ");
/Www/www.myapp.com/myapp/config/config.php configuration is as follows:
View code
<? PHP // array ('_ Public _' => '/myapp' must be'/myapp' // If array ('_ Public __ '=> 'myapp' // use the response array ('db _ type' => 'myapp ', 'url _ model' => 1, 'db _ host' => 'localhost', 'db _ name' => 'myapp ', 'db _ user' => 'root', 'db _ pwd' => '', 'db _ port' => '123 ', 'db _ prefix' => 'ma _ ', 'url _ model' => 0, 'tmpl _ parse_string '=> array (' _ Public _ '=>'/myapp' ),);?>
Other
/Www/www.myapp.com/myapp/lib/action/index.class.php in the index () method, $ this-> display (); you can call the template...
For example, the index module template should be as follows:
/Www/www.myapp.com/myapp/tpl/index/index.html
/Www/www.myapp.com/myapp/tpl/index/header.html
/Www/www.myapp.com/myapp/tpl/index/footer.html
In the header, you can use the following statements to call JS and CSS:
View code
<link href="__PUBLIC__/Public/css/a.css" rel="stylesheet" type="text/css" /><script src="__PUBLIC__/Public/js/a.js" type="text/javascript"></script><script src="__PUBLIC__/Public/js/b.js" type="text/javascript" ></script>
Index.htmlimport header.html: <include file = "Header"/>
Other modules, such as add)
/Www/www.myapp.com/myapp/lib/action/add.class.php in the index () method, $ this-> display (); you can call the template...
For example, the index module template should be as follows:
/Www/www.myapp.com/myapp/tpl/add/index.html
The value is that you can use the index.html header.html: <include file = "index: Header">
This is almost the case. Linux seems to be case sensitive!