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

functions.php默认已经加入autoload了,如何使用呢? #76

Open
gudufun opened this issue Dec 19, 2018 · 1 comment
Open

functions.php默认已经加入autoload了,如何使用呢? #76

gudufun opened this issue Dec 19, 2018 · 1 comment

Comments

@gudufun
Copy link

gudufun commented Dec 19, 2018

functions.php默认已经加入autoload了,如何使用呢?

@phalapi
Copy link
Owner

phalapi commented Jan 24, 2019

正常使用即可,遵循PSR-4的规范,在调用函数前要注意加命名空间,如:

    public function testMyFun() {
        // 错误!会提示 App\Api\my_fun()函数不存在!
        //(假设在./src/app/functions.php有此函数)
        my_fun();  

        // 正确!调用前要加上用绝对命名空间路径
        \App\my_fun();  
    }

更多可参考:http://docs.phalapi.net/#/v2.0/autoload

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