Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/298.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
Php 使用.htaccess在整个项目中重写字符串_Php_.htaccess - Fatal编程技术网

Php 使用.htaccess在整个项目中重写字符串

Php 使用.htaccess在整个项目中重写字符串,php,.htaccess,Php,.htaccess,我有一个字符串“这很有趣”。我想换成“只是好玩” 我们可以使用.htaccess文件进行更改吗。我写了这条规则 RewriteRule ^this is fun JUST fun 但什么也没发生。我无法将每个文件都更改为其庞大的项目,并且已经部署在服务器上 我们只能使用.htaccess来执行此操作 否。.htaccess用于Apache web服务器配置,不用于在PHP中执行字符串替换。您可以在PHP脚本本身上更改它。如果在多个位置有类似的字符串。然后将其作为变量保存在配置文件或这些页面上

我有一个字符串“这很有趣”。我想换成“只是好玩”
我们可以使用.htaccess文件进行更改吗。我写了这条规则

RewriteRule ^this is fun  JUST fun
但什么也没发生。我无法将每个文件都更改为其庞大的项目,并且已经部署在服务器上


我们只能使用.htaccess来执行此操作

否。
.htaccess
用于Apache web服务器配置,不用于在PHP中执行字符串替换。

您可以在PHP脚本本身上更改它。如果在多个位置有类似的字符串。然后将其作为变量保存在配置文件或这些页面上包含的文件中,然后使用该变量。我不认为通过htaccess的方式