tp5.1 初始化方法是initialize,不是_initialize,tp5.0 初始化方法_initialize ThinkPHP的控制器和模型初始化不起作用 初始化方法的注意事项 : a)使用初始化方法必须继承Controller控制器类 b)输出必须使用echo,return输出是不会显示 ...
分类:
其他好文 时间:
2020-03-13 12:56:32
阅读次数:
94
在tp5中官方给出的去隐藏index.php方法如下: [ Apache ] httpd.conf配置文件中加载了mod_rewrite.so模块 AllowOverride None 将None改为 All 把下面的内容保存为.htaccess文件放到应用入口文件的同级目录下 <IfModule ...
分类:
Web程序 时间:
2020-02-22 00:18:11
阅读次数:
111
当前有两个版本 路由设置 Route::get('api/:version/banner/:id', 'api/:version.Banner/getBanner'); Version:1 地址 zerg.so/api/v1/banner/1 返回 "this is v1 version" Vers ...
分类:
其他好文 时间:
2020-02-17 16:11:47
阅读次数:
169
原来的地址http://xxxxxxx/index.php/admin/login/index.html 修改完的路径http://xxxxxxx/admin/login/index.html 修改.htaccess文件 <IfModule mod_rewrite.c> Options +Follo ...
分类:
Web程序 时间:
2020-02-07 15:00:36
阅读次数:
133
V5.0.17+版本开始,当你的order排序中使用了SQL函数的时候,请使用orderRaw方法替代order,例如: Db::table('think_user')->where('status=1')->orderRaw('rand()')->limit(5)->select(); Db::n ...
分类:
编程语言 时间:
2020-01-23 12:24:48
阅读次数:
134
<?php namespace page; use think\Paginator; class Page extends Paginator { //首页 protected function home() { if ($this->currentPage() > 1) { return "<a ...
分类:
其他好文 时间:
2020-01-20 11:19:20
阅读次数:
113
index控制器--从数据库获取值 <?php namespace app\index\controller; class Index { public function api($title = '') { if (!$title) { $data = model('Shici')->find() ...
使用模型查询的返回的结果集为对象,其中里面的数据,TP5框架会自动对里面的data:protected该项进行处理。 但有时我们就想要数据,就想返回一个数组就可以了,怎么办?有两种方法可以实现: 方法一:找到TP5框架中的database.php文件,该文件中找到 resultset_type 该项 ...
分类:
编程语言 时间:
2020-01-04 18:25:14
阅读次数:
272
1、composer安装thinkphp 2、进入tp5根目录 3、安装gatewayworker 4、官网下载linux版本demo:http://www.workerman.net/download 5、将Applications/Yourapp复制到tp5目录application中,并更改名 ...
分类:
其他好文 时间:
2020-01-04 18:15:23
阅读次数:
505