qingchen
- qingchen 2018-05-08 已签到连续签到7天,获得了20个金钱
- qingchen 2018-05-07 已签到连续签到6天,获得了20个金钱
- qingchen 2018-05-06 已签到连续签到5天,获得了20个金钱
- qingchen 2018-05-05 已签到连续签到4天,获得了20个金钱
“返回json时用 return $this->asjason([...])有时会报错”
具体报的什么错,是不是 不方便说?asJson内存溢出
name PHP Fatal Error
message Allowed memory size of 134217728 bytes exhausted (tried to allocate 20480 bytes)
code 1
type yii\base\ErrorException
file /www/wwwroot/test02/vendor/yiisoft/yii2/helpers/BaseJson.php
line 163正常应返回
{"state":"SUCCESS","url":"/uploads/images/201805/1525434256593896.jpg","title":"1525434256593896.jpg","original":"avatar.jpg","type":".jpg","size":17079}- qingchen 2018-05-04 已签到连续签到3天,获得了15个金钱
- qingchen 回答了问题 Yii 2.0 控制器action 问题
控制器中$this->run($route, $params = []) 可以调用另一个action
例:ueditor插件中`public function actionIndex() {
$request = Yii::$app->getRequest(); $method = $request->get('action'); $callback = $request->get('callback'); if (in_array($method, ['config', 'uploadimage', 'uploadscrawl', 'uploadvideo', 'uploadfile', 'listimage', 'listfile', 'catchimage'])) { return $this->run($method); } return $this->show(['state' => '请求地址出错']); } public function actionUploadimage() { $setting = $this->config(); $config = [ "pathFormat" => $setting['imagePathFormat'], "maxSize" => $setting['imageMaxSize'], "allowFiles" => $setting['imageAllowFiles'] ]; $res = $this->_upload($setting['imageFieldName'], $config, 'upload'); return $this->show($res); }
`
- qingchen 2018-05-03 已签到连续签到2天,获得了10个金钱
- qingchen 2018-05-02 已签到连续签到1天,获得了5个金钱