[英]PHP - Fatal error class not found
I have the below contents in one of my files 我的一个文件中包含以下内容
<?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);
Currently I'm seeing nothing but bare text on my web page and my apache log contains the following 目前,我的网页上只看到裸文本,而我的apache日志包含以下内容
[Mon Oct 19 20:08:58.683738 2015] [:error] [pid 9552] [client 107.137.15.190:58709] PHP Fatal error: Class 'querystring' not found in /var/www/html/inc/common.php on line 28
[2015年10月19日星期一20:08:58.683738] [:错误] [pid 9552] [客户端107.137.15.190:58709] PHP致命错误:在/var/www/html/inc/common.php中找不到类'querystring'在第28行
This is the contents of the query file. 这是查询文件的内容。
<?
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;
}
}
I'd like to add that this was working before I moved my application to adifferent machine / server. 我想补充一点,在我将应用程序移动到另一台机器/服务器之前,这是可行的。
The biggest difference is that I went from php 5.3 to php 5.5.9 最大的不同是我从php 5.3转到了php 5.5.9
I'm not sure why it is now not being recognized. 我不确定为什么现在不被认可。
Please change the <?
请更改
<?
to <?php
in the beginning of the querystring class' file. 到查询字符串类文件开头的
<?php
。
Some servers do not recognize <?
有些服务器无法识别
<?
as PHP, being recommended the use of <?php
instead. 作为PHP,建议使用
<?php
代替。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.