框架:https://www.thinkphp.cn/doc
创建网站
域名自己写
创建文件夹,“test”拉取框架,地址栏输入
composer create-project topthink/think=5.1.* tp5
会自动创建一个tp5文件夹
根目录选择刚刚创建拉框架的文件夹
以test为示例
“D:\test\tp5”
配置文件:
D:\test\tp5\config\app.php
默认地址:
D:\test\tp5\application\index\controller\ index.php
<?php
// 文件名
namespace app\index\controller;
//类名
class Test
{ // 函数名 (参数)public function hello($name){ // .拼接return $name . 'acb';}public function hello1(){ // json格式// db引用数据库// couple表明// select() 查找全部return json(db('couple')->select()) ;return 'acb';}
}
数据库配置:
D:\test\tp5\config
在页面访问:
http://localhost:9001/public/index.php/index/test/hello1