PHP - 找不到致命错误类

时间:2015-10-20 00:16:02

标签: php linux apache class reference

我的一个档案中有以下内容

<?php
require_once(DIR_INCLUDE .'/jsonwrapper/jsonwrapper.php');
require_once(DIR_INCLUDE .'/template.class.php');
require_once(DIR_INCLUDE .'/string.func.php');
require_once(DIR_INCLUDE .'/filesystem.func.php');
require_once(DIR_INCLUDE .'/database.php');
require_once(DIR_INCLUDE .'/login.class.php');
require_once(DIR_INCLUDE .'/user.class.php');
require_once(DIR_INCLUDE .'/querystring.class.php');
require_once(DIR_INCLUDE .'/resource.class.php');
require_once(DIR_INCLUDE .'/cache_thumbnail.class.php');
require_once(DIR_INCLUDE .'/hook.class.php');
require_once(DIR_INCLUDE .'/controller.class.php');
require_once(DIR_MODULES .'/pages/page.class.php');
require_once(DIR_MODULES .'/settings/settings.class.php');

/* Database Connect */
// Moved to config.php
// db_connect(DB_HOST,DB_USER,DB_PASSWORD,DB_NAME);

/* Handle Login Posting */
$login = new login();

if($login->is_login()){
  $login_user = new user($login->info['user_id']);

}
$common['querystring'] = new querystring($_GET);

目前我在网页上只看到裸露的文字,而我的apache日志包含以下内容

  

[Mon Oct 19 20:08:58.683738 2015] [:error] [pid 9552] [客户   107.137.15.190:58709] PHP致命错误:第28行的/var/www/html/inc/common.php中找不到类'查询字符串'

这是查询文件的内容。

<?
class querystring{
  var $myQueryString;
  var $original;

  function querystring($getvar){

    unset($getvar['path']);

    $this->myQueryString = $getvar;
    $this->original = $getvar;
  }

  function remove($except){
    if($except =="")return;

    $str_except = "";
    if(is_array($except)){
      foreach($except as $x){
        $str_except .= "[$x]";
      }
    }else{
      if($except!=""){
        $str_except = "[$except]";
      }
    }

    $str_ret = "";
    unset($new_qs);
    foreach($this->myQueryString as $key => $value){
      if(strpos(' '. $str_except, '['. $key .']')==0){
        $new_qs[$key] = $value;
      }
    }
    $this->myQueryString = $new_qs;
  }

  function add($key, $value){
    $this->myQueryString[$key] = $value;
  }

  function reset(){
    $this->myQueryString = $this->original;
  }

  function to_string(){
    if(is_array($this->myQueryString)){
      foreach($this->myQueryString as $key => $value){
        if($str_ret == ""){
          $str_ret = "?". $key . "=" . urlencode($value) ;
        }else{
          $str_ret .= "&". $key . "=" . urlencode($value) ;
        }
      }
    }
    return $str_ret;
  }

}

我想补充说,在我将应用程序移动到不同的机器/服务器之前,这是有效的。

最大的区别是我从php 5.3到php 5.5.9

我不确定为什么它现在不被认可。

1 个答案:

答案 0 :(得分:0)

请将<?更改为查询字符串类文件开头的<?php
有些服务器无法将<?识别为PHP,建议使用<?php代替。