thinkphp Generating static data configuration

Source: Internet
Author: User
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

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.