本文介绍了找不到PHP类别,但包含在内的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我将包含一个PHP类
require_once($ENGINE."/classUser.php");
但是执行代码时,我收到此错误:
but when the code is executed i receive this error:
我仍然不知道出了什么问题.我有99%的把握是正确的.
I still can't figure out what's the problem. I'm 99% sure it's correct.
"$ ENGINE"是正确的,并且类也是正确的(Netbeans建议我使用类方法和变量).
The "$ENGINE" is correct, and the class is correct too (Netbeans suggests me class methods and variables).
signup.php:
signup.php:
<?php
/* Created on: 13/12/2011
* Author:
*
* Description: User signup procedure.
*/
require_once("../settings.php");
require_once($ENGINE."/classUser.php");
$user = new User();
$user->createUser($_POST["username"], $_POST["email"], $_POST["password"]);
?>
classUser.php:
classUser.php:
<?php
/* Created on: 13/12/2011
* Author:
*
* Description: This class manages users.
*/
require_once("settings.php");
require_once($LIBRARY."/cassandraphp/cassandra.php");
class User {
public function createUser($username, $email, $password){
$cassandra = Cassandra::createInstance($CASSANDRASERVER);
$cassandra->set(
"user.".$username,
array(
'ID' => uniqid(),
'Username' => $username,
'Email' => $email,
'Password' => $password
)
);
}
}
?>
推荐答案
首先检查$ENGINE."/classUser.php"
是否为现有文件的有效名称.试试这个:
First of all check if $ENGINE."/classUser.php"
is a valid name of existing file.Try this:
var_dump(file_exists($ENGINE."/classUser.php"));
这篇关于找不到PHP类别,但包含在内的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!