php 无法打开流 - 没有这样的文件或目录

发布于 2024-10-21 06:57:11 字数 691 浏览 2 评论 0原文

我有以下 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

梦里°也失望 2024-10-28 06:57:11

正如错误所述,“scores.php?filename=scores/score.sco&scoresize=10&action=VIEW&viewtype=HTML”不是文件或目录。仅仅因为您可以在 Web 浏览器中输入查询字符串参数(“?”及其后)并不意味着这些参数是文件名的一部分。文件名是scores.php

看起来您想要通过网络服务器发出请求,而不仅仅是打开本地文件。幸运的是, include 本身也允许。但是,您必须指定它:

<html>
  <body>
    <?php include('http://someserver.com/scores.php?filename=scores/score.sco&scoresize=10&action=VIEW&viewtype=HTML'); ?>
  </body>
</html>

或者(最好是保存 HTTP 请求),如果 scores.php 位于同一网络服务器上,您可以将其作为普通文件访问,但设置 $_GET 参数事先,因为这些将通过 include 指令生存:

<html>
  <body>
    <?php
    $_GET = Array('filename' => 'scores/score.sco'); // add the others here too
    include('scores.php');
    ?>
  </body>
</html>

希望有帮助。

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:

<html>
  <body>
    <?php include('http://someserver.com/scores.php?filename=scores/score.sco&scoresize=10&action=VIEW&viewtype=HTML'); ?>
  </body>
</html>

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 the include directive:

<html>
  <body>
    <?php
    $_GET = Array('filename' => 'scores/score.sco'); // add the others here too
    include('scores.php');
    ?>
  </body>
</html>

Hope that helps.

玩世 2024-10-28 06:57:11

问题在于您已将其指定为通过文件系统进行访问,而实际上您需要通过 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.

我爱人 2024-10-28 06:57:11

据我所知,不能使用包含参数,它必须是文件名。您可以设置 $_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.

酷到爆炸 2024-10-28 06:57:11

您不能使用 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')

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文