Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/.htaccess/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
当脚本不在URL中时,如何允许PHP运行?_Php_.htaccess_Url_Web - Fatal编程技术网

当脚本不在URL中时,如何允许PHP运行?

当脚本不在URL中时,如何允许PHP运行?,php,.htaccess,url,web,Php,.htaccess,Url,Web,我想让一个PHP脚本运行时,我在我的网站上的某个文件夹,但不让它显示在URL 我希望在用户访问/number时运行/number/number.php/ 是否需要使用.htaccess文件执行此操作?您可以尝试在此文件夹上创建index.php文件,并使用include语句包含number.php。就我现在所知,每次您在URL中键入文件夹时,服务器搜索要运行的索引文件,而index.php不包括在URL中。如果您希望在不让用户访问该页面的情况下运行脚本。。您只需将该文件包含在另一个文件中即可。。

我想让一个PHP脚本运行时,我在我的网站上的某个文件夹,但不让它显示在URL

我希望在用户访问/number时运行/number/number.php/


是否需要使用.htaccess文件执行此操作?

您可以尝试在此文件夹上创建index.php文件,并使用include语句包含number.php。就我现在所知,每次您在URL中键入文件夹时,服务器搜索要运行的索引文件,而index.php不包括在URL中。

如果您希望在不让用户访问该页面的情况下运行脚本。。您只需将该文件包含在另一个文件中即可。。例如,您可以在文件夹/number/中创建index.php,其中包含以下代码:

<?php
include("./numbers.php"); /* the './' means, it refers to the same folder */
?>
可能的重复可能的重复