ZF1中的Request::getPathInfo()方法的ZF2等价物是什么?
您可以很容易地从Uri实例获取路径信息,这可以通过Request示例访问。
在任何控制器动作中;
$path = $this->getRequest()->getUri()->getPath();
有关更多详细信息,请查看Zend''Uri和Zend''Http''Request类。
$request = new 'Zend'Http'PhpEnvironment'Request();
var_dump($request->getUri());
object(Zend'Uri'Http)[5]
protected 'validHostTypes' => int 19
protected 'user' => null
protected 'password' => null
protected 'scheme' => string 'http' (length=4)
protected 'userInfo' => null
protected 'host' => string 'localhost' (length=9)
protected 'port' => null
protected 'path' => string '/iptcms/public_html/test.php' (length=28)
protected 'query' => string '' (length=0)
protected 'fragment' => null