Heim  >  Fragen und Antworten  >  Hauptteil

Apache php 单一入口 丢失Post数据

场景:把单向入口做的跟彻底,即把访问文件夹或不存的文件指向index.php入口。于是把.htaccess中的 RewriteCond %{REQUEST_FILENAME} !-d 注释掉。

最终配置如下:

<IfModule mod_rewrite.c> 

Options +FollowSymlinks

RewriteEngine on 

#RewriteCond %{REQUEST_FILENAME} !-d 

RewriteCond %{REQUEST_FILENAME} !-f 

RewriteRule ^(.*)$ index.php/$1

</IfModule>


这样就出现问题了

例:项目App中有个目录Api

https://xxxx/Api 这样访问就会丢失Post数据

https://xxxx/Api/ 这样访问不会丢失Post数据

当Api目录不存在是两种访问都没问题


phpcn_u1317phpcn_u13172735 Tage vor1201

Antworte allen(1)Ich werde antworten

  • 数据分析师

    数据分析师2017-10-01 01:10:43

    Apache php 单一入口 丢失Post数据-PHP中文网问答-Apache php 单一入口 丢失Post数据-PHP中文网问答

    围观一下哦,学习一下。

    Antwort
    0
  • StornierenAntwort