使用layout控制模板布局

D:\LearnWebDevelop\php\thinkphp_3.2.3_full\Application\News\Controller\UserController.class.php

<?php

namespace News\Controller;
use Think\Controller;
class UserController extends Controller {
    
    Public function add2() {
    layout(true);
    $this->display('add2');
    }
    
}

D:\LearnWebDevelop\php\thinkphp_3.2.3_full\Application\News\View\User\add2.html

<body>
D:\LearnWebDevelop\php\thinkphp_3.2.3_full\Application\News\View\User\add2.html
</body>

D:\LearnWebDevelop\php\thinkphp_3.2.3_full\Application\News\View\layout.html

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>D:\LearnWebDevelop\php\thinkphp_3.2.3_full\Application\News\View\layout.html</title>
</head>
{__CONTENT__}
</html>

view-source:localhost/thinkphp323/index.php/News/User/add2

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>D:\LearnWebDevelop\php\thinkphp_3.2.3_full\Application\News\View\layout.html</title>
</head>

<body>
D:\LearnWebDevelop\php\thinkphp_3.2.3_full\Application\News\View\User\add2.html
</body>

</html>

 

posted @ 2017-12-05 10:21  sky20080101  阅读(198)  评论(0)    收藏  举报