douhao8456 2012-05-01 05:23
浏览 70

PHP $ _GET [url]无效

HI im trying to develop a MVC pattern through a website , from the beginning I need to get url I tried like this

echo $url= $_GET['url'];
echo $url;

If i use a url like this http://localhost/autolink/index/sdsad it wanna show "index/sdsad" but its not showing anything, what can be wrong on this? can be a version problem? coz used in a another machine it was working..

This is my current .htaccess:

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]
  • 写回答

1条回答 默认 最新

  • douhan1860 2012-05-01 05:27
    关注

    If that url was working on another machine then you had some sort of rewrite rules in place. You likely had something like:

    RewriteEngine On
    RewriteRule ^autolink/.* autolink.php/?url=$0 [QSA,PT]
    

    This would make the index/sdsad get passed in as a url argument in the query string.

    Your example works for me and implies that you either

    1. Don't have mod_rewrite turned on
    2. Don't have Allow Overrides turned on

    Easiest way to check (assuming this is not a production server) is to edit the .htaccess file and put in something like "POOP" on the first line. If you start getting 500 errors, then 1 and 2 above do not apply.

    评论

报告相同问题?

悬赏问题

  • ¥15 基于卷积神经网络的声纹识别
  • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 stm32开发clion时遇到的编译问题