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

我用最新的框架,在API调取Domain中出问题 #77

Open
XiaoHei880323 opened this issue Dec 20, 2018 · 1 comment
Open

我用最新的框架,在API调取Domain中出问题 #77

XiaoHei880323 opened this issue Dec 20, 2018 · 1 comment

Comments

@XiaoHei880323
Copy link

下载最新的框架后。什么都都没有修改,在src的api的user中调用domain层,但是提示没有找到
api层的代码如下:
$domain = new \Domain_User();
$userInfo = $domain->getUserInfo() ;
print_r($userInfo) ;exit ;
在Domain层中,创建User.php文件类名:Domain_user,方法未getUserInfo().代码如下:
class Domain_User
{
public function getUserInfo(){
return [1,2] ;
}
}

按照文档和案例来看,应该没有什么问题,但是提示就是找不到


Fatal error: Uncaught Error: Class 'Domain_User' not found in D:\WWW\phalapi\src\app\Api\User.php:28
Stack trace:
#0 [internal function]: App\Api\User->login()
#1 D:\WWW\phalapi\vendor\phalapi\kernal\src\PhalApi.php(53): call_user_func(Array)
#2 D:\WWW\phalapi\public\index.php(9): PhalApi\PhalApi->response()
#3 {main}
thrown in
D:\WWW\phalapi\src\app\Api\User.php on line
28

@phalapi
Copy link
Owner

phalapi commented Dec 20, 2018

类的文件名和类名没对应上,路径不对,可参考PSR-4: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