0

你好,我正在使用 PHP,我想将我的 classes 文件夹中的 class.php 文件包含到我的页面之一中,但它显示错误:

警告:require_once(/usr/home/shantak5/public_html/gman/classes/globalProgram.class.php)[function.require-once]:无法打开流:/usr/home/shantak5/public_html 中没有这样的文件或目录/gman/adminGlobalProgram.php 第 18 行

致命错误:require_once() [function.require]:无法打开所需的“/usr/home/shantak5/public_html/gman/classes/globalProgram.class.php”(include_path='/usr/home/shantak5/public_html/gman/ PEAR') 在第 18 行的 /usr/home/shantak5/public_html/gman/adminGlobalProgram.php

我无法知道我的代码出了什么问题。我的 .class.php 文件位于 Classes 文件夹中。

这是我的 adminglobalprogram.php 的 php 代码,我在其中添加了 require once 函数。:

<?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');
?>
4

2 回答 2

2

是不是很简单?

/usr/home/shantak5/public_html/gman/classes/globalProgram.class.php

此文件:globalProgram.class.php 此处不存在 : /usr/home/shantak5/public_html/gman/classes/

于 2013-02-01T07:21:44.833 回答
1

此错误仅在以下情况下发生,

1)您的文件不在定义的位置。

2) 提到的文件和定位的文件之间存在名称冲突。

3) 文件中有任何区分大小写的字母。

请根据您的情况检查上述内容

于 2013-02-01T07:23:30.677 回答