多应用:
http://serverName/index.php/应用/控制器/操作/参数/值...
单应用:
http://serverName/index.php/控制器/操作/参数/值...
tp6.0默认但应用模式,多应用需要作为扩展安装
控制器:app目录下目录名叫controller 控制器目录的Test.php(控制器)
Test.php 控制器的类名也必须是class Test 否则错误
操作就是控制器类里面的方法 比如 index方法 或者hello 方法
完整形式:
a、http://localhost/tp6/public/index.php/test/hello/value/world
b、http://127.0.0.1:8000/index.php/test/hello/value/world
在app/controller 目录下:
<?php
namespace app\controller;
class Test
{
// http://www.tp6stu.com/index.php/test/index
public function index()
{
return 'test'; //test
}
//http://www.tp6stu.com/index.php/test/hello/value/world
public function hello($value = '')
{
return 'hello,'.$value; //hello,world
}
}项目中 index.php 可以省略 设置url重写即可
url 兼容模式
如果不支持pathinfo模式,还可以使用兼容模式方式访问
http://localhost/tp6/public/?s=test/hello/value/world