Post variables not sending : php / apache / codeigniter

和自甴很熟 提交于 2020-01-07 05:27:39

问题


I got a problem with an application built in codeigniter. The $_POST variables are not working, var_dump($_POST) returns array(0)

In online environment works fine, so it's localhost problem.

I think its the apache conf or the .htacces conf, I'm adding the .htacces used in this project.

Any help its really appreciated, thanks.

<IfModule mod_rewrite.c>

RewriteEngine On
RewriteBase /

RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)/$ $1 [L,R=301]

RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php/$1 [L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]

</IfModule>

<IfModule !mod_rewrite.c>
    ErrorDocument 404 /index.php
</IfModule>

回答1:


Can you put your controller and form code in here too? Potentially not an apache issue.




回答2:


Are you able to access any controller through your browser? If true, then that is not a problem with your htaccess. Further, have you enabled CSRF in your config settings? If true, trying disabling and check if you will get any values in your dump. From there, it might be easier to help you.




回答3:


Thanks for the answers below. However it was a single issue with the apache configuration.

The mod rewrite module was disabled, generating some kind of redirection with the post forms. I enabled it with the command a2enmod rewrite and everything worked like a charm.

Hope this helps someone in the future.



来源:https://stackoverflow.com/questions/17845482/post-variables-not-sending-php-apache-codeigniter

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!