控制器不存在:V1
来源:8-12 Theme接口验证与重构
parr
2017-08-04
namespace app\api\controller\v1; use app\api\validate\IDCollection; class Theme { public function getSimpleList($ids=''){ (new IDCollection())->goCheck(); return 'success'; } }
<?php /** * Created by PhpStorm. * User: zfw * Date: 2017/8/4 * Time: 16:45 */ namespace app\api\validate; class IDCollection extends BaseValidate { protected $rule = [ 'ids' => 'require|checkIDs' ]; protected $message = [ 'ids' => 'ids必须是以,结束的正整数' ]; protected function checkIDs($value) { $values = explode(',',$value); if (empty($values)) { return false; } foreach ($values as $id) { if (!$this->isPositiveInteger($id)) { return false; } } return true; } }
Route::get('api/:version/banner/:id','api/:version.Banner/getBanner'); Route::get('api/:version/theme','api/:version.Theme/getSimpleList');
写回答
1回答
-
7七月
2017-08-06
不加version参数可以访问吗?
012024-03-30