TP手册学习第三天

  1. 命令行
    先在cmd进入项目目录,再执行命令

    1. 生成index模块的Blog控制器类库文件:php think make:controller index/Blog
    2. 如果仅仅生成空的控制器则可以使用:php think make:controller index/Blog --plain
    3. 清除缓存文件(runtime目录):php think clear
    4. 清除指定目录下的文件:php think clear --path d:www p5 untimelog
  2. 引用模板(路径以 项目目录/public/ 路径下为起点):{include file="public/header,public/menu" /}
    或者直接包含一个模版文件名(包含完整路径),例如:{include file="../application/view/default/public/header.html" /}
    支持传入参数,如:
    {include file="Public/header" title="$title" keywords="开源WEB开发框架" /}
    模板中的使用方法为:
    1.<html xmlns="http://www.w3.org/1999/xhtml">
    2.<head>
    3.<title> [title] </title>   #变量的使用方法
    4.<meta name="keywords" content=" [keywords] " />
    5.</head>
    

      

  3. 在模板中输出文件:$this->assign(['data1'=>$data1,'data2'=>$data2]);
原文地址:https://www.cnblogs.com/yolo-bean/p/7834295.html