thinkphp generating a static file configuration
$this->buildhtml (' Hello ', ' user/', ' Index ');
So it was produced in the user directory? Hello.shtml
There is also a cache configuration
By the way, the production cache is a point, not immediately generated, etc. arrive at a certain time automatic production static page is quite practical
In cofig.php configuration
if (!defined (' Think_path ')) exit ();
Return Array (
?' Html_cache_on ' =>true,
?' Html_cache_time ' =>10,//time unit is seconds
?' Html_read_type ' =>0,
);
?
?
?
--------------------------
?
Projects in c:/www/tp/admin/
Generated static file target c:/www/tp/html/
Use a function dirname to return the path of the stripped file? Like tp/dl/123.php? If you use dirname, the absolute path is returned C:/TP/DL
index.php Portal File Configuration
Say what's important.
Define (' Web_path ', DirName (__file__));
Define (' No_cache_runtime ', true);//debug
?
config.php
Project configuration Plus. htm
html_file_suffix = '. htm '
?
I'm using a map in the controller.
function Create () {
Echo Think_path;
$path = DirName (web_path). ' \html\\ ';
$path = DirName (dirname (web_path). ' \html ');
echo $path;
$this->buildhtml (' loves ', $path, ' Index ');
}
?
?
------------------------
?
1.UrlcreateAction put on Web projects
Public Function Url_news_view () {
Header ("content-type:text/html; Charset=utf-8 ");
$dirpath = dirname ($_server[' script_filename '). ' /html/';//html root directory? The last one/is necessary
$news = M (' new ');
$list = $news->select ();
foreach ($list as $var) {
$id = $var [' new_id '];
$this->assign (' data ', $var);
Var_dump ($id);
$this->buildhtml ("news/{$var [' Addtime ']}", $dirpath, "Index:news_view");???
}
}
Generates a static page for the content after the Index:news_view operation template is output