麻烦诸位了,帮忙看看是什么问题。我是新手,折腾好久了,还是无法解决问题。
路由文件
Route::get('/', function () {
return view('welcome');
});
Route::group(['middleware' => ['web']], function () {
// 不要放这里就不会启用 csrf});
Route::any('/wechat', 'WechatController@serve');
控制器文件
class WechatController extends Controller
{
public function serve()
{
Log::info('request arrived.');
$wechat = app('wechat');
$wechat->server->setMessageHandler(function($message){
return "欢迎关注 overtrue!";
});
Log::info('return response.');
return $wechat->server->serve();
}
}
laravel日志
[2016-04-07 17:49:27] local.ERROR: exception 'Illuminate\Session\TokenMismatchException' in /var/www/wechat_riguo/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/VerifyCsrfToken.php:67
Stack trace:
#0 [internal function]: Illuminate\Foundation\Http\Middleware\VerifyCsrfToken->handle(Object(Illuminate\Http\Request), Object(Closure))
#1 /var/www/wechat_riguo/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(124): call_user_func_array(Array, Array)
#2 [internal function]: Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
.......后面还有好长......
WeChat日志
[2016-04-07 17:59:40] easywechat.DEBUG: Current configuration: {"debug":true,"use_laravel_cache":true,"app_id":"wxa286a68def0e2c","secret":"8cbb4a67c5b3d50844d6252ccb1817","token":"wechat","aes_key":"OAdbkQMMv7i6wytvBQbsCWCAvlhf6kiofG6R1i9DpCE","log":{"level":"debug","file":"/var/www/wechat_riguo/storage/logs/wechat.log" []
[2016-04-07 17:59:40] easywechat.DEBUG: Request received: {"Method":"GET","URI":"/wechat?signature=bdf0cd824e1d0ef663f9d093308480e6565e0f62&echostr=3427265654774280636×tamp=1460051980&nonce=413835758","Query":"echostr=3427265654774280636&nonce=413835758&signature=bdf0cd824e1d0ef663f9d093308480e6565e0f62×tamp=1460051980","Protocal":"HTTP/1.0","Content":""} []
[2016-04-07 17:59:40] easywechat.DEBUG: Output 'echostr' is '3427265654774280636'. [] []