I have a papge require api to post
inside of my route setting is
Route::post('/commitmoney/{api}/{payment}', 'CommitmoneyController@post');
my problem is in my middleware verifyCsrfToken.php I couldn't set variable like below
protected $except = [
'/commitmoney/{api}/{payment}',
is anyone know how to solve this problem?
You have to use a *
to make it work, instead of your named parameters:
protected $except = [
'/commitmoney/*/*',
...
];
在构造函数里进行对$exceptf赋值
class VerifyCsrfToken extends Middleware
{
/**
* VerifyCsrfToken constructor.
* @param Application $app
* @param Encrypter $encrypter
* 在初始化函数中设置except
*/
public function __construct(Application $app, Encrypter $encrypter){
parent::__construct($app, $encrypter);
$this->except = [
route('admin.ueditor')
];
}
}
用*代替变量