thinkphp模块

来源:互联网 发布:淘宝直通车类目出价 编辑:程序博客网 时间:2024/05/02 00:13
下载thinkphp压缩包,解压到www目录下,定位到Application---Home---Controller文件夹,模块在此目录下访问和创建

IndexController.class.php
<?php
namespace Home\Controller;
use Think\Controller;
class IndexController extends Controller{
public function index(){
echo "hello,world!";
}
public function add(){
echo "add方法调用成功";
}
}
?>
域名访问index方法:http://localhost/index.php/Home/Index(模块名)/index(方法名)
默认情况下是访问index,所以也可以http://localhost/index.php/Home/
域名访问add方法:http://localhost/index.php/Home/Index/add

新建一个模块
UserController.class.php
<?php
namespace Home\Controller;
use Think\Controller;
class UserController extends Controller{
public function delete(){
echo "delete方法调用成功";
}
}
?>
域名访问delete方法:http://localhost/index.php/Home/User(模块名)/delete(方法名)
0 0
原创粉丝点击