PHP5包括不起作用? [英] PHP5 Include Doesn't Work?

查看:42
本文介绍了PHP5包括不起作用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在使用PHP进行在线目录系统(由于服务器限制)。通常情况下,我会使用其他东西,但是我可以使用它!我在服务器上有我的页面(Login.php,SomethingElse.php等.php)。所有这些都有某种形式的PHP代码与它们相关联。

在我的cgi-bin文件夹中,我有代码引用我的数据文件(目前是XML,以后可能会切换到MySQL)。我收到错误,说

无法打开文件:../cgi-bin / path.xml"和包括的东西。


现在,我做了一些研究,它声称使用php5,代码不能在不同目录中使用包含行。我的问题是:

1.这是真的吗?

2.如果是这样,是否有另一个地方我可以放置我的文件,所以用户不能看他们? (代码和数据)


谢谢大家。我刚刚开始使用php进行这个项目,所以我真的没有任何线索。此外,它是我的第一个服务器项目,所以cgi-bin的东西来自我在网上看过的东西。在此先感谢您的帮助。


- LB

I''m currently working on an online directory system using PHP (due to server constraints). Normally I would use something else but c''est la vie! I have my pages on the server (Login.php, SomethingElse.php, etc.php). All of them have some form of php code associated with them.
In my cgi-bin folder, I have the code which references my data files (XML for now, may switch to MySQL later). I am getting errors that say
"cannot open file: ../cgi-bin/path.xml" and something about include.

Now, I did some research and it claims that with php5, the code cannot use an include line for a file in a different directory. My question(s) are:
1. Is this true?
2. If so, is there another place I can put my files so the user can''t see them? (code and data)

Thanks all. I''ve just started working with php for this project so I really don''t have a clue. Also, it''s my first server project so the cgi-bin stuff was from stuff I''ve seen online. Thanks in advance for the help.

- LB

推荐答案

一个XML文件?为什么要将它包含在您的php文件中?我能看到你到目前为止使用的特定编码吗?
a XML file? why do you want to include this in your php file. can I see specific coding that you have used so far, please !


XML的原因是因为我最初将它编码为servlet来修改大学课程中的一个例子。所以我编写了XML文件,然后发现servlet不能在我们的服务器上运行。


话虽如此,这里是代码:

[php]

<?php session_start;

//include("../cgi-bin/PHP/dirlogin.php");

//include("../other/dirlogin.php" );

The reason for the XML was because I was originally going to code it as a servlet modifying an example from a college class. So I made up the XML files and then found out servlets won''t work on our server.

Having said that, here''s the code:
[php]
<?php session_start;
//include("../cgi-bin/PHP/dirlogin.php");
//include("../other/dirlogin.php");


_SESSION [''usedID''] =" Not Found";


函数登录()

{
_SESSION[''usedID'']="Not Found";

function login()
{


这篇关于PHP5包括不起作用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆