致命错误:require_once():无法打开required'\php';(包括路径=';B:\xamp\php\pear';)
致命错误:require_once():无法打开所需的'.\DbConnect.php' (包括_path='B:\xamp\php\pear')在 第12行的B:\xamp\htdocs\Library\includes\DbOperations.php致命错误:require_once():无法打开required'\php';(包括路径=';B:\xamp\php\pear';),php,pear,Php,Pear,致命错误:require_once():无法打开所需的'.\DbConnect.php' (包括_path='B:\xamp\php\pear')在 第12行的B:\xamp\htdocs\Library\includes\DbOperations.php '?'这是一个用文本?而不是参数的字符串。请阅读:此错误的确切原因是什么?回显此目录名(_文件)。'/DbConnect.php'并验证文件路径是否正确 <?php include'B:\xamp\php\pear'; class Db
'?'
这是一个用文本?
而不是参数的字符串。请阅读:此错误的确切原因是什么?回显此目录名(_文件)。'/DbConnect.php'
并验证文件路径是否正确
<?php
include'B:\xamp\php\pear';
class DbOperations{
private $con;
function __construct(){
require_once dirname(_FILE_).'/DbConnect.php'; -->Error
$db = new DbConnect();
$this->con = $db->connect();
}
/*CRUD -> C -> CREATE*/
/*********************STUDENT TABLE******************************/
function createstudent($username,$password,$email){
$password = md5($pass);
$stmt = $this->con->prepare("INSERT INTO `tbl_student` (`id`, `username`, `email`, `password`, `CourseName`, `Semester`, `RegDate`, `updationDate`) VALUES (NULL, '?', '?', '?', '?', '?', current_timestamp(), NULL);");
$stmt->bind_param("sss",$username,$password,$email);
/*$stmt->bind_param(':username',$username,PDO::PARAM_STR);
$stmt->bind_param(':password',$password,PDO::PARAM_STR);
$stmt->bind_param(':email',$email,PDO::PARAM_STR);*/
if($stmt->excute()){
return true;
}
else {
return false;
}
}
?>
<?php
//include('B:\xamp\php\pear');
class DbConnect{
private $con;
function __construct(){
}
function connect(){
include_once dirname(_FILE_).'/Constants.php';
$this->con = new mysqli(DB_HOST,DB_USER,DB_PASS,DB_NAME);
if(mysqli_connect_errno()){
echo "Failed to connect with Database".mysqli_connect_err();
}
return $this->con;
}
}
?>