How to read $_GET variables with (mod rewrite powered) nice URLs(如何使用(mod 重写支持)漂亮的 URL 读取 $_GET 变量)
问题描述
各位程序员好,
我第一次使用不错的 URL,但我不太明白为什么我无法从脚本中读取 oAuth 响应.
I'm using nice URLs the first time and I can't quite find out why I can't read my oAuth responses from my script.
这是我的设置:
.htaccess
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?url=$1 [PT,L]
我有一个使用 googles oAuth 系统登录用户的脚本.此脚本将用户发送到 google api 页面,在那里他们可以允许我的网站读取他们的电子邮件地址,然后将用户发送回我的网站,并使用许多 $_GET 变量.
I have a script that uses googles oAuth system to log in a user. This script sends the user to the google api page where they can allow my website to read their email adress and then send the user right back to my site with lots of $_GET variables.
我告诉谷歌将它发送到
http://mywebsite/login/google/response
它做到了..
问题是 google 以正常的 GET 格式发送结果,如下所示:
The problem is that google sends the result in the normal GET format like this:
http://mywebsite/login/google/response/?openid.ns=http%3A%2F%2Fspecs.openid.ne[..]
我的脚本无法读取..
当 $_GET 变量与漂亮的 URL 混合时,有没有办法读取它们?
Is there any way to read $_GET variables when they mix with nice URLs?
推荐答案
您需要添加QSA(查询字符串追加)到您的标志.
You need to add QSA (query string append) to your flags.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?url=$1 [QSA,PT,L]
然后您的 $_GET 将包含正确的值.
Then your $_GET will contain the correct values.
这篇关于如何使用(mod 重写支持)漂亮的 URL 读取 $_GET 变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何使用(mod 重写支持)漂亮的 URL 读取 $_GET 变量
基础教程推荐
- 如何在 Laravel 中使用 React Router? 2022-01-01
- 如何替换eregi() 2022-01-01
- PHP 类:全局变量作为类中的属性 2021-01-01
- 在PHP中根据W3C规范Unicode 2022-01-01
- Cron Jobs 调用带有变量的 PHP 脚本 2022-01-01
- YouTube API v3 点赞视频,但计数器不增加 2022-01-01
- PHP PDO MySQL 查询 LIKE ->多个关键词 2021-01-01
- 学说 dbal querybuilder 作为准备好的语句 2022-01-01
- 有什么方法可以用编码 UTF-8 而不是 Unicode 返回 PHP`json_encode`? 2021-01-01
- 如何在 Laravel 5.3 注册中添加动态下拉列表列? 2021-01-01
