在WAMPServer环境下PHP编程时如何正确设置访问路径

WBOY
Release: 2016-06-23 14:04:16
Original
1022 people have browsed it

自从将WampServer升级到2.2(Apache 2.4.2; PHP 5.4.3; MySql 5.5.24)后运行以前写的php程序,总是报错,不知如何解决,求诸位指点。多谢。这次遇到的问题是:



上图为源码所在folder。
index.php保存在“www/ARTivismInventory/admin/”;
function源码global.inc.php和pic_functions.php保存在“www/ARTivismInventory/admin/includes/”
class源码比如UserTools.class.php和DB.class.php等等保存在“www/ARTivismInventory/admin/classes/”

部分index.php源码:

<?phprequire_once 'includes/global.inc.php';$modul_name=$_REQUEST['modul_name']?$_REQUEST['modul_name']:"main";//$objPages=new Pages();//$page_id=$objPages->getPageID($modul_name);?><html><head><title>Content management System</title><meta http-equiv="Content-Type" content="text/html; charset=windows-1251"><link rel="stylesheet" href="css/admin.css" type="text/css"><script src="images/editer.js"></script><script src="images/menu.js"></script></head><body>&middot;&middot;&middot;&middot;&middot;&middot;&middot;&middot;</body></html>
Copy after login



部分global.inc.php源码

<?php//start the sessionsession_start();require_once 'classes/User.class.php';require_once 'classes/UserTools.class.php';require_once 'classes/DB.class.php';require_once 'classes/Group.class.php';require_once 'classes/Contact.class.php';require_once 'classes/Profile.class.php';//require_once 'classes/Pages.class.php';require_once 'pic_functions.php';//connect to the database$db = new DB();$db->connect();//initialize UserTools object$userTools = new UserTools();&middot;&middot;&middot;&middot;&middot;&middot;&middot;?>
Copy after login



部分UserTools.class.php源码

<?//UserTools.class.phprequire_once 'User.class.php';require_once 'DB.class.php';class UserTools {&middot;&middot;&middot;&middot;&middot;&middot;&middot;&middot;}?>
Copy after login


此组程序如ftp到远端由第三方提供的web host上工作正常,但在本地WampServer下运行则有如下错误信息:




回复讨论(解决方案)

require_once '../classes/User.class.php'; 
下面的几个类的包含也改成这样试试

require_once '../classes/User.class.php'; 
下面的几个类的包含也改成这样试试


这个试过,错误变成:

这个图清晰一些

我原来也遇到这种新版本报错,好像是新版本中好几个函数被取消的原因,换了以后就好了
还有就是引用变量的时候放在函数()里面也会报错,先单独定义一下再引用就没事了

UserTools.class.php源码

//UserTools.class.php

这不是很明显吗?你的程序需要打开短标记支持,而php默认配置中是关闭的

楼上版主威武。谢各位,结贴。

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template