Zend Routing——从 URL 中使用 & 而不是斜线抓取变量 - Tapjoy
Zend Routing -- Grabbing Variables from URL with Ampersands and not Slashes - Tapjoy
我目前正在创建尝试与 Tapjoy API 集成他们的回调 URL 请求,该请求以这种形式出现:
<callback_url>?snuid=<user_id>¤cy=&mac_address=<mac_address>&display_multiplier=<display_multiplier>
但是,使用 ZF1 --
Zend_Controller_Router_Route 似乎取决于由斜杠而不是&符号分隔的变量分隔。
这是我当前的路线代码
> $router->addRoute( 'api-tapjoy', new Zend_Controller_Router_Route('api/tapjoy?snuid=:snuid&mac_address=:&mac_address&display_multiplier....etc.etc,
array('controller'=>'api', 'action' =>'tapjoy')));
每当我删除和号和初始问号并用斜杠替换它们时,它就会起作用。如何在使用 & 符号的同时正确接收 HTTP 请求?
看来我明白了。它与符号和斜线等无关,而是我的路线没有正确创建。
我被this documentation on ZF1's website about routers:
甩了
The first parameter in the Zend_Controller_Router_Route constructor is
a route definition that will be matched to a URL. Route definitions
consist of static and dynamic parts separated by the slash ('/')
character. Static parts are just simple text: author. Dynamic parts,
called variables, are marked by prepending a colon to the variable
name: :username.
我目前正在创建尝试与 Tapjoy API 集成他们的回调 URL 请求,该请求以这种形式出现:
<callback_url>?snuid=<user_id>¤cy=&mac_address=<mac_address>&display_multiplier=<display_multiplier>
但是,使用 ZF1 -- Zend_Controller_Router_Route 似乎取决于由斜杠而不是&符号分隔的变量分隔。
这是我当前的路线代码
> $router->addRoute( 'api-tapjoy', new Zend_Controller_Router_Route('api/tapjoy?snuid=:snuid&mac_address=:&mac_address&display_multiplier....etc.etc,
array('controller'=>'api', 'action' =>'tapjoy')));
每当我删除和号和初始问号并用斜杠替换它们时,它就会起作用。如何在使用 & 符号的同时正确接收 HTTP 请求?
看来我明白了。它与符号和斜线等无关,而是我的路线没有正确创建。
我被this documentation on ZF1's website about routers:
甩了The first parameter in the Zend_Controller_Router_Route constructor is a route definition that will be matched to a URL. Route definitions consist of static and dynamic parts separated by the slash ('/') character. Static parts are just simple text: author. Dynamic parts, called variables, are marked by prepending a colon to the variable name: :username.