php 无法打开流 - 没有这样的文件或目录
我有以下 php 代码:
<html><body>
<?php include('scores.php?filename=scores/score.sco&scoresize=10&action=VIEW&viewtype=HTML'); ?>
</body>
</html>
您可以在此处查看结果: http://apps.facebook.com/krajecr/pokus2.php
如您所见,它告诉我,它不存在。但如果我只使用链接: http:// /apps.facebook.com/krajecr/scores.php?filename=scores/score.sco&scoresize=10&action=VIEW&viewtype=HTML 它工作得很好,我看到的正是我想看到的。请问问题出在哪里?
I have the following php code:
<html><body>
<?php include('scores.php?filename=scores/score.sco&scoresize=10&action=VIEW&viewtype=HTML'); ?>
</body>
</html>
You can see the result here:
http://apps.facebook.com/krajecr/pokus2.php
As you can see, it tells me, that it doesn't exist. But if I use just the link:
http://apps.facebook.com/krajecr/scores.php?filename=scores/score.sco&scoresize=10&action=VIEW&viewtype=HTML
it works fine an I see exactly what I want to see. Where is the problem please?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
正如错误所述,“scores.php?filename=scores/score.sco&scoresize=10&action=VIEW&viewtype=HTML”不是文件或目录。仅仅因为您可以在 Web 浏览器中输入查询字符串参数(“?”及其后)并不意味着这些参数是文件名的一部分。文件名是
scores.php
。看起来您想要通过网络服务器发出请求,而不仅仅是打开本地文件。幸运的是,
include
本身也允许。但是,您必须指定它:或者(最好是保存 HTTP 请求),如果
scores.php
位于同一网络服务器上,您可以将其作为普通文件访问,但设置$_GET
参数事先,因为这些将通过include
指令生存:希望有帮助。
As the error says, "scores.php?filename=scores/score.sco&scoresize=10&action=VIEW&viewtype=HTML" is not a file or directory. Just because you can enter querystring parameters ("?" and after) into your web browser does not mean that these are part of the filename. The filename is
scores.php
.It looks like you want to go and make a request through a webserver rather than just opening a local file. Fortunately,
include
allows that natively too. However, you have to specify it:Alternatively (and preferably, to save an HTTP request), if
scores.php
is on the same webserver, you can access it as a normal file but set the$_GET
parameters beforehand, as these will survive through theinclude
directive:Hope that helps.
问题在于您已将其指定为通过文件系统进行访问,而实际上您需要通过 Web 服务器进行访问。输入完整的网址。
更好的是,将脚本转换为包含到函数中,然后包含并调用它。
The problem is that you've specified it as an access via the filesystem, when you actually need to have it access via the web server. Put in the full URL.
Better yet, convert the script to include into a function and then include and call it.
据我所知,不能使用包含参数,它必须是文件名。您可以设置 $_GET['var'] = 'value';在您致电之前,请包括一种可行的方法。
As far as I know, you cannot use an include with parameters, it must be a file name. You can set the $_GET['var'] = 'value'; before your call to include for a way that does work.
您不能使用 get 值进行包含。
设置所有您的获取值
您可以使用$_GET[..] = ...
,然后执行
include('scores.php')
you cannot do an include with get values.
you can set all ur ness get values with
$_GET[..] = ...
and then do
include('scores.php')