Php 对成员函数的调用
我有下面的代码,我试图理解并找到解决这个错误的方法Php 对成员函数的调用,php,codeigniter,Php,Codeigniter,我有下面的代码,我试图理解并找到解决这个错误的方法 A PHP Error was encountered Severity: Notice Message: Undefined property: Tank_auth::$users Filename: libraries/Tank_auth.php Line Number: 188 Fatal error: Call to a member function UpdateProfileInfo() on a non-object i
A PHP Error was encountered
Severity: Notice
Message: Undefined property: Tank_auth::$users
Filename: libraries/Tank_auth.php
Line Number: 188
Fatal error: Call to a member function UpdateProfileInfo() on a non-object in /home/xtremer/public_html/kowmanager/application/libraries/Tank_auth.php on line 188
坦克认证控制器:
坦克验证模型:
坦克认证库:
编辑:多亏了马克,他才发现了这个问题,但奇怪的是,我确实有一个新问题
A PHP Error was encountered
Severity: Notice
Message: Undefined index: userID
Filename: libraries/Tank_auth.php
Line Number: 188
A PHP Error was encountered
Severity: Warning
Message: Cannot modify header information - headers already sent by (output started at /home/xtremer/public_html/system/core/Exceptions.php:170)
Filename: libraries/Session.php
Line Number: 671
A PHP Error was encountered
Severity: Warning
Message: Cannot modify header information - headers already sent by (output started at /home/xtremer/public_html/system/core/Exceptions.php:170)
Filename: helpers/url_helper.php
Line Number: 543
看起来您的tank_auth/users.php模型没有加载,或者某处存在命名冲突。您的$autoload数组看起来像什么?可能相关: 第187行:
$this->ci->users
第188行:
$this->users->UpdateProfileInfo(…)代码>
在Tank Auth Library中忘记了一个->ci
?它看起来不像application/libraries/Tank_Auth.php
有188行??您粘贴的任何代码示例中都没有$users,并且没有任何代码示例有188行。你在拖延我们……我只是想给出相关的代码,这样就不会让任何人讨厌帮助。我更新了所有链接,以包含完整的代码。$autoload['libraries]=array('database'、'template'、'asset'、'session');这解决了一件事。有趣的是,我修复了一个问题,另一个问题被发现了。我的新错误在我的post.PHP数组中。数组键区分大小写。可能是userid
或userid
而不是userid?
很难说。一旦修复了未定义的索引警告,标题错误/警告就会消失。我更改了$this->ci->users->UpdateProfileInfo($userInfo['userID'],$userInfo['first\u name'],$userInfo['last\u name']);到这个$this->ci->users->UpdateProfileInfo($userInfo['user\u id'],$userInfo['first\u name'],$userInfo['last\u name']);但仍然出现了同样的错误。这太令人沮丧了,但我离这太近了。试着做var\u dump($userInfo)
,看看里面有什么,而不仅仅是猜测键名。