Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

似乎Facade不起作用 #1

Closed
hareluya opened this issue Apr 13, 2015 · 2 comments
Closed

似乎Facade不起作用 #1

hareluya opened this issue Apr 13, 2015 · 2 comments

Comments

@hareluya
Copy link

Hi, 我按照手册引入了相关的provider和facade。但是在controller中使用Wechat::时,报找不到相关的类。很迷惑哟~

@hareluya
Copy link
Author

Dear,
我发现问题在哪里了。。
我这种小菜鸟经常犯地错误-0-,Facade前要加 \ 。。。
记录在这里,让后人可以免得再犯咯。。

class WechatController extends Controller {

public function serve()
{
    \Wechat::on('message', function ($message)
    {
        \Log::info("收到来自'{$message['FromUserName']}'的信息:'{$message['Content']}'");

    });

    return \Wechat::serve();


}

}

@overtrue
Copy link
Owner

在文件头部use即可:

<?php

namespace App\Http\Controllers;

use Wechat;
use Log;

class WechatController {
     public function serve() {
        Wechat::on('message', function ($message)
        {
            Log::info("收到来自'{$message['FromUserName']}'的信息:'{$message['Content']}'");

        });

        return Wechat::serve();
     }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants