【问题标题】:php open other files locallyphp在本地打开其他文件
【发布时间】:2015-05-15 05:04:37
【问题描述】:

所以我在同一个目录中有一个 index.php 文件和一个 scrapper.php 文件。 我在该目录中使用我的 mac 终端,然后启动 php -S localhost:8888。 当我访问 localhost:8888 时,会显示 index.php。太棒了。

但是,我也想在浏览器中查看 scraper.php 文件,但我不知道如何操作。 请帮我。 到目前为止,我已经尝试过:

http://localhost:8888/scraper (仅显示我的 index.php)。

我也加入了 <?php include("./scraper.php"); ?> 在我的 index.php 中。

我可以在终端中看到交互: [2015 年 5 月 14 日星期四 21:57:43] 127.0.0.1:60411 [200]: /background.jpg [2015 年 5 月 14 日星期四 21:57:45] 127.0.0.1:60416 [200]: /scraper

但是现在浏览。 请帮忙。

【问题讨论】:

  • 你试过-http://localhost:8888/scraper.php吗?
  • <?php include(__DIR__ . "/scraper.php"); ?>怎么样
  • ttp://localhost:8888/scraper.php 成功了!谢谢

标签: php localhost


【解决方案1】:

sgt BOS 的解决方案奏效了。 需要在末尾附加.php

【讨论】:

    猜你喜欢
    • 2013-11-27
    • 2023-03-16
    • 2015-04-18
    • 1970-01-01
    • 1970-01-01
    • 2012-03-06
    • 1970-01-01
    • 2011-08-22
    • 1970-01-01
    相关资源
    最近更新 更多