thinkphp5单一上传和批量上传
<?php
namespace app\before\controller;
use think\facade\Request;
class Upload
{
public function Index()
{
$file = Request::file('file');
$info = $file-&...
thinkphp5 模型获取器
控制层
<?php
namespace app\before\controller;
use think\Controller;
use think\Db;
use app\before\model\Article as ArticleModel;
class Article extends Controller
{
public func...
thinkphp5 模型新增/批量删除 闭包删除
控制文件:
<?php
namespace app\before\controller;
use think\Controller;
use think\Db;
use app\before\model\Article as ArticleModel;
class Article extends Controller
{
public fu...
thinkphp5 子查询 闭包查询
<?php
namespace app\before\controller;
use think\Controller;
use think\Db;
//use app\before\model\Article;
class Before extends Controller
{
public function Index()
{
$sj = ...
thinkphp5 增删改查
<?php
namespace app\before\controller;
use think\Controller;
use think\Db;
//use app\before\model\Article;
class Before extends Controller
{
public function Index()
{
...
thinkphp5 查询数据库
控制层文件
<?php
namespace app\before\controller;
use think\Controller;
use think\Db;
use app\before\model\Article;
class Before extends Controller
{
public function Index()
...
thinkphp5空方法检查
<?php
namespace app\test\controller;
use think\Controller;
class YangZheWei
{
public function _empty($name)
{
return '此方法不存在:<br>'.$name;
}
}
?>
thinkphp5判断跳转
<?php
namespace app\test\controller;
use think\Controller;
class YangZheWei extends Controller
{
protected $flag = false;
public function index()
{
if($thi...
thinkphp5 初始化灵活方法
<?php
namespace app\test\controller;
use think\Controller;
class YangZheWei extends Controller
{
protected $beforeActionList = [
'than',
'first' => ['exce...
thinkphp5 初始化
<?php
namespace app\test\controller;
use think\facade\Env;
use think\Controller;
class YangZheWei extends Controller
{
protected function initialize(){
parent::initialize();
ech...
1 2