Php 在Restler iAuthenticate实现中获取请求的服务
我正在使用Restler开发一个restapi,我需要从iAuthenticate实现中获取请求的服务 到目前为止,我已经设法做到了:Php 在Restler iAuthenticate实现中获取请求的服务,php,regex,url,restler,Php,Regex,Url,Restler,我正在使用Restler开发一个restapi,我需要从iAuthenticate实现中获取请求的服务 到目前为止,我已经设法做到了: $m = preg_match('/.+?\/(?P<api>.+?)\/(?P<service>\w+)/', $_SERVER['REQUEST_URI']); $m=preg\u匹配('/.+?\/(?P与我的实际uri) 当我试图在iAuthenticate实现中解析请求url时,它就是不起作用 有人知道如何在restler i
$m = preg_match('/.+?\/(?P<api>.+?)\/(?P<service>\w+)/', $_SERVER['REQUEST_URI']);
$m=preg\u匹配('/.+?\/(?P与我的实际uri)
当我试图在iAuthenticate实现中解析请求url时,它就是不起作用
有人知道如何在restler iAuthenticate实现中启用regex吗?我如何在restler中显示错误而不是空白页
谢谢
[编辑]
我没有传递变量来存储match对象,preg\u match
接收第三个参数来存储它,并返回一个布尔值。Case closed。我最终这样解决了它:
preg_match('/.+?\/(?P<api>.+?)\/(?P<service>\w+)/', $_SERVER['REQUEST_URI'], $mo);
$api = $mo['api'];
$service = $mo['service'];
preg\u match(“/。+?\/(?P+?)\/(?P\w+/”,$\u服务器['REQUEST\u URI'],$mo);
$api=$mo['api'];
$service=$mo['service'];
我终于这样解决了这个问题:
preg_match('/.+?\/(?P<api>.+?)\/(?P<service>\w+)/', $_SERVER['REQUEST_URI'], $mo);
$api = $mo['api'];
$service = $mo['service'];
preg\u match(“/。+?\/(?P+?)\/(?P\w+/”,$\u服务器['REQUEST\u URI'],$mo);
$api=$mo['api'];
$service=$mo['service'];
目的是什么?可能有更好的方法来实现您想要的。Restler已经找到了api类和api方法。目的是什么?可能有更好的方法来实现您想要的。Restler已经找到了api类和api方法