自定義腳本
有時我們需要寫一些臨時腳本,在這些腳本可以像webman一樣調用任意的類或接口,完成比如數據導入,數據更新統(tǒng)計等操作。這在webman中是已經非常容易的事情,例如:
新建 scripts/update.php
(目錄不存在請自行創(chuàng)建)
<?php
require_once __DIR__ . '/../vendor/autoload.php';
require_once __DIR__ . '/../support/bootstrap.php';
use think\facade\Db;
$user = Db::table('user')->find(1);
var_dump($user);
當然我們也可以使用webman/console
自定義命令來完成這樣的操作,參見命令行