视图定义规范默认是模块目录下面的 View/控制器名/操作名.html

<?php
namespace Home\Controller;
use Think\Controller;
class IndexController extends Controller {
    //http://localhost/thinkphp323/index.php
    //http://localhost/thinkphp323/index.php/Home/Index/index
    public function index(){
        echo 'hello,thinkphp!';
    }


//下面是一个标准的URL访问格式:
//http://serverName/index.php/模块/控制器/操作

//类似.NET MVC&WebAPI 访问传值方式
//visit:  http://localhost/thinkphp323/index.php/home/index/hello/name/baby
//output: hello,baby!
//visit:  http://localhost/thinkphp323/index.php/home/index/hello?name=JIm
//output: hello,JIm!
//visit:  http://localhost/thinkphp323/index.php/home/index/hello
//output: hello,thinkphp!
//visit:  http://localhost/thinkphp323/?s=/home/index/hello/name/JImGreen
//output: hello,JImGreen!
    public function hello_bak($name='thinkphp'){
        echo 'hello,'.$name.'!';
    }

    public function hello($name='thinkphp'){
        $this->assign('name',$name);
        $this->display();
    }
}

D:\LearnWebDevelop\php\thinkphp_3.2.3_full\Application\Home\Controller\IndexController.class.php

 

<html>
<head>
<title>hello {$name}</title>
</head>
<body>
hello/Hi!~~~, {$name}!
</body>
</html>

D:\LearnWebDevelop\php\thinkphp_3.2.3_full\Application\Home\View\Index\hello.html

 

http://localhost/thinkphp323/?s=/home/index/hello/name/JImGreen

hello/Hi!~~~, JImGreen!

posted @ 2017-11-23 14:56  sky20080101  阅读(76)  评论(0)    收藏  举报