问题描述
使用Chargeify与Codeigniter框架。使用Chargify完成注册后,可以使用参数设置返回网址。看来这些参数只能返回?id = 123& ref = 321。使用Codeigniter,如何获取这些返回参数?
Using Chargify with Codeigniter framework. On completion of signup with Chargify, the return URL can be set with parameters. It seems that these parameters can only be returned ?id=123&ref=321. With Codeigniter, how do I grab those return paramenters?
http://www.website.com/confirmation?id=3163255&ref=5159c58278a1f
推荐答案
CodeIgniter默认破坏 $ _ GET
变量,通常用于访问URL中的参数。
CodeIgniter, by default, destroys the $_GET
variable that one would usually use to access the parameters in a URL.
此行将解析URL并使用URL的参数填充 $ _ GET
数组。当你想在CodeIgniter项目中有选择地使用 $ _ GET
数组时,而不是必须启用CodeIgniter的查询字符串
This line will parse the URL and populate the $_GET
array with the URL's parameters. It's useful for when you want to selectively use the $_GET
array in a CodeIgniter project, rather than having to enable CodeIgniter's query strings, which would be globally and continually active.
parse_str(substr(strrchr($_SERVER['REQUEST_URI'], "?"), 1), $_GET);
然后可以像访问数组一样访问它,例如:
It can then be accessed as you would normally access an array, for example:
$id = $_GET['id'];
$ref = $_GET['ref'];
这篇关于Codeigniter检索Chargify返回参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!