你好我正在使用PHP,我希望将我的classes文件夹中的class.php文件包含到我的一个页面中,但它显示错误:
警告: require_once(/usr/home/shantak5/public_html/gman/classes/globalProgram.class.php) [function.require-once]:无法打开流:没有这样的文件或 目录 第18行/usr/home/shantak5/public_html/gman/adminGlobalProgram.php
致命错误:require_once()[function.require]:打开失败 需要 ' /usr/home/shantak5/public_html/gman/classes/globalProgram.class.php' (include_path =' / usr / home / shantak5 / public_html / gman / PEAR')in 第18行/usr/home/shantak5/public_html/gman/adminGlobalProgram.php
我无法知道我的code.my .class.php文件在Classes文件夹中有什么问题。
这是我的adminglobalprogram.php的php代码,其中我添加了一次require函数。:
<?php
require 'config.inc.php';
error_reporting(E_ALL);
if(!$_SESSION['isLogged'])
header("Location: index.php");
if(isset($_GET['hid']) && $_GET['hid'] == 1){
$show = "yes";
}else{
$show = "no";
}
if(isset($_GET['mod'])){
$update = "yes";
$itemId = $_GET['mod'];
}else{
$update = "no";
}
require_once(APP_CLASS_PATH."globalProgram.class.php");
$objForm = new pevcProgram;
$message = "";
if(isset($_POST['saveProgram'])){
$timeval = mysql_real_escape_string($_POST['timeval']);
$timeheading = mysql_real_escape_string($_POST['timeheading']);
$descriptionheading = mysql_real_escape_string($_POST['descriptionheading']);
$description = mysql_real_escape_string($_POST['description']);
$description=stripslashes($description);
$descriptionheading1 = mysql_real_escape_string($_POST['descriptionheading1']);
$description1 = mysql_real_escape_string($_POST['description1']);
$description1=stripslashes($description1);
$descriptionheading2 = mysql_real_escape_string($_POST['descriptionheading2']);
$description2 = mysql_real_escape_string($_POST['description2']);
$description2 =stripslashes($description2);
$descriptionheading3 = mysql_real_escape_string($_POST['descriptionheading3']);
$description3 = mysql_real_escape_string($_POST['description3']);
$description3 =stripslashes($description3);
$image = $_FILES['image']['name'];
if($flag !== 0){
if(!empty($image)){
$bgSource = $_FILES['image']['tmp_name'];
$ext = strtolower(substr(strrchr($image, "."), 1));
if($ext == "png" || $ext == "jpg" || $ext == "jpeg" ){
/* Open This code
$imgpathD = 'photos/'.topBarBgtest.".$ext";
$imgpath = './photos/'.topBarBgtest.".$ext";
*/
$imgpathD = 'photos/program/'.'Global_'.$image;
$imgpath = './photos/program/'.'Global_'.$image;
if(move_uploaded_file($bgSource, $imgpath)){
//$message .= "Image successfully uploaded.<br />";
}else{
$flag = 0;
}
}else{
$flag = 0;
}
}
}
//$content = mysql_real_escape_string($_POST['FCKeditor1']);
$line = $_POST['line'];
$srorder = $_POST['srorder'];
$status = $_POST['status'];
$fieldInfo = array(
'timeval' => $timeval,
'timeheading' => $timeheading,
'descriptionheading'=>$descriptionheading,
'description' => $description,
'descriptionheading1'=>$descriptionheading1,
'description1' => $description1,
'descriptionheading2'=>$descriptionheading2,
'description2' => $description2,
'descriptionheading3'=>$descriptionheading3,
'description3' => $description3,
'image' => $image,
'line' => $line,
'srorder' => $srorder,
'status' => $status);
$recId = $objForm->addFormField($fieldInfo);
if(isset($recId) && $recId != ""){
$message .= "Form successfully saved!!.<br />";
}else{
$message .= "Error!Form data not saved.Please try again!!.<br />";
}
}
if(isset($_POST['update']))
{
//$content = mysql_real_escape_string($_POST['FCKeditor1']);
$timeval = mysql_real_escape_string($_POST['timeval']);
$timeheading = mysql_real_escape_string($_POST['timeheading']);
$descriptionheading = mysql_real_escape_string($_POST['descriptionheading']);
$description = mysql_real_escape_string($_POST['description']);
$description=stripslashes($description);
$line = $_POST['line'];
$descriptionheading1 = mysql_real_escape_string($_POST['descriptionheading1']);
$description1 = mysql_real_escape_string($_POST['description1']);
$description1 =stripslashes($description1);
$descriptionheading2 = mysql_real_escape_string($_POST['descriptionheading2']);
$description2 = mysql_real_escape_string($_POST['description2']);
$description2 =stripslashes($description2);
$descriptionheading3 = mysql_real_escape_string($_POST['descriptionheading3']);
$description3 = mysql_real_escape_string($_POST['description3']);
$description3 =stripslashes($description3);
//image uploade//
$image = $_FILES['image']['name'];
if($flag !== 0){
if(!empty($image)){
$bgSource = $_FILES['image']['tmp_name'];
$ext = strtolower(substr(strrchr($image, "."), 1));
if($ext == "png" || $ext == "jpg" || $ext == "jpeg" ){
/* Open This code
$imgpathD = 'photos/'.topBarBgtest.".$ext";
$imgpath = './photos/'.topBarBgtest.".$ext";
*/
$imgpathD = 'photos/program/'.'Global_'.$image;
$imgpath = './photos/program/'.'Global_'.$image;
if(move_uploaded_file($bgSource, $imgpath)){
//$message .= "Image successfully uploaded.<br />";
}else{
$flag = 0;
}
}else{
$flag = 0;
}
}
}
$srorder = $_POST['srorder'];
$status = $_POST['status'];
$updId = $_POST['updId'];
$fieldInfo = array('timeval' => $timeval,
'timeheading' => $timeheading,
'descriptionheading'=>$descriptionheading,
'description' => $description,
'descriptionheading1'=>$descriptionheading1,
'description1' => $description1,
'descriptionheading2'=>$descriptionheading2,
'description2' => $description2,
'descriptionheading3'=>$descriptionheading3,
'description3' => $description3,
'image' => $image,
'line' => $line,
'srorder' => $srorder,
'status' => $status);
$recId = $objForm->updateFormInfo($updId,$fieldInfo);
if(isset($recId) && $recId != "")
{
$message .= "Form successfully updated!!.<br />";
}else
{
$message .= "Error!Form data not updated.Please try again!!.<br />";
}
}
/*unset($_GET['update']);*/
/* srorder update accroding text input*/
if(isset($_POST['textsubmit']))
{
//$content = mysql_real_escape_string($_POST['FCKeditor1']);
$timeval = mysql_real_escape_string($_POST['timeval']);
$timeheading = mysql_real_escape_string($_POST['timeheading']);
$descriptionheading = mysql_real_escape_string($_POST['descriptionheading']);
$description = mysql_real_escape_string($_POST['description']);
$description=stripslashes($description);
$descriptionheading1 = mysql_real_escape_string($_POST['descriptionheading1']);
$description1 = mysql_real_escape_string($_POST['description1']);
$description1 =stripslashes($description1);
$descriptionheading2 = mysql_real_escape_string($_POST['descriptionheading2']);
$description2 = mysql_real_escape_string($_POST['description2']);
$description2 =stripslashes($description2);
$descriptionheading3 = mysql_real_escape_string($_POST['descriptionheading3']);
$description3 = mysql_real_escape_string($_POST['description3']);
$description3 =stripslashes($description3);
//image uploade//
$image = $_FILES['image']['name'];
if($flag !== 0){
if(!empty($image)){
$bgSource = $_FILES['image']['tmp_name'];
$ext = strtolower(substr(strrchr($image, "."), 1));
if($ext == "png" || $ext == "jpg" || $ext == "jpeg" ){
/* Open This code
$imgpathD = 'photos/'.topBarBgtest.".$ext";
$imgpath = './photos/'.topBarBgtest.".$ext";
*/
$imgpathD = 'photos/program/'.'Global_'.$image;
$imgpath = './photos/program/'.'Global_'.$image;
if(move_uploaded_file($bgSource, $imgpath)){
//$message .= "Image successfully uploaded.<br />";
}else{
$flag = 0;
}
}else{
$flag = 0;
}
}
}
$line = $_POST['line'];
$srorder = $_POST['srorder'];
$status = $_POST['status'];
$updId = $_POST['updId'];
$fieldInfo = array('timeval' => $timeval,
'timeheading' => $timeheading,
'descriptionheading'=>$descriptionheading,
'description' => $description,
'descriptionheading1'=>$descriptionheading1,
'description1' => $description1,
'descriptionheading2'=>$descriptionheading2,
'description2' => $description2,
'descriptionheading3'=>$descriptionheading3,
'description3' => $description3,
'image' => $image,
'line' => $line,
'srorder' => $srorder,
'status' => $status);
$recId = $objForm->updateFormInfo($updId,$fieldInfo);
if(isset($recId) && $recId != "")
{
$message .= "Form successfully updated!!.<br />";
}else
{
$message .= "Error!Form data not updated.Please try again!!.<br />";
}
}
if(isset($_GET['Rmod'])){
$itemId = $_GET['Rmod'];
$formretu = $objForm->deleteRec($itemId);
if($formretu){
$message .= "Record successfully Deleted!!.<br />";
}else{
$message .= "Record not Deleted!!.<br />";
}
}
if($update == "yes"){
$formArr = $objForm->getFormInfo($itemId);
$timeval = $formArr->timeval;
//$content = $formArr->content;
//$content = stripslashes($content);
$timeheading = $formArr->timeheading;
$descriptionheading = $formArr->descriptionheading;
$description = $formArr->description;
$descriptionheading1 = $formArr->descriptionheading1;
$description1 = $formArr->description1;
$descriptionheading2 = $formArr->descriptionheading2;
$description2 = $formArr->description2;
$descriptionheading3 = $formArr->descriptionheading3;
$description3 = $formArr->description3;
$image = $formArr->image;
$line = $formArr->line;
$srorder = $formArr->srorder;
$status = $formArr->status;
}
$asiaArr = $objForm->getAllAsiaProg1();
$upNUM = $objForm->isRecord();
$upNUM = $upNUM;
$recNum = $objForm->isRecord();
$recNum = $recNum + 1;
//print_r($_SESSION);
$smarty->assign('show', $show);
$smarty->assign('update', $update);
$smarty->assign('timeval', $timeval);
$smarty->assign('timeheading', $timeheading);
$smarty->assign('descriptionheading', $descriptionheading);
$smarty->assign('description', $description);
$smarty->assign('descriptionheading1', $descriptionheading1);
$smarty->assign('description1', $description1);
$smarty->assign('descriptionheading2', $descriptionheading2);
$smarty->assign('description2', $description2);
$smarty->assign('descriptionheading3', $descriptionheading3);
$smarty->assign('description3', $description3);
$smarty->assign('image', $image);
//$smarty->assign('content', $content);
$smarty->assign('line', $line);
$smarty->assign('srorder', $srorder);
$smarty->assign('status', $status);
$smarty->assign('asiaArr', $asiaArr);
$smarty->assign('itemId', $itemId);
$smarty->assign('upNUM', $upNUM);
$smarty->assign('recNum', $recNum);
//$smarty->assign('content', $newContent);
$smarty->assign('message', $message);
//$smarty->assign('sno', $sno);
$smarty->display('adminGlobalProgram.tpl');
?>
答案 0 :(得分:2)
不是这么简单吗?
/usr/home/shantak5/public_html/gman/classes/globalProgram.class.php
此文件:globalProgram.class.php
此处不存在:/usr/home/shantak5/public_html/gman/classes/
。
答案 1 :(得分:1)
仅在
时发生此错误1)您的文件不在定义的位置。
2)上述文件与所在位置之间存在名称冲突 文件。
3)文件中有任何区分大小写的字母。
请在您的案例中查看以上内容