Hyperlink Typo3在控制器中生成链接

Hyperlink Typo3在控制器中生成链接,hyperlink,controller,typo3,Hyperlink,Controller,Typo3,我面临这样的问题: 我正在尝试在控制器中获取uri。我通过JSON创建了一个API和返回链接。看来我能做到 <f:link.action action="list" arguments="{location : location, myId : location.uid}">>&nbsp;</f:link.action> > 但如何在控制器中生成上述链接? 提前感谢。您是否尝试过$this->uriBuilder->uriFor(),它将为您获取URI,

我面临这样的问题: 我正在尝试在控制器中获取uri。我通过JSON创建了一个API和返回链接。看来我能做到

<f:link.action action="list" arguments="{location : location, myId : location.uid}">>&nbsp;</f:link.action>
>
但如何在控制器中生成上述链接?
提前感谢。

您是否尝试过
$this->uriBuilder->uriFor()
,它将为您获取URI,您可以根据需要打开自己的链接。

谢谢。我这样试过:$uri=$this->uriBuilder->uriFor('list',array('location'=>'location','myId'=>$value->getUid());鉴于此,我只需要这些信息。它返回tx_locations\u locationsfe[location]=location&tx_locations\u locationsfe[myId]=95&tx_locations\u locationsfe[action]=list&tx_locations\u locationsfe[controller]=location&cHash=77440a3c879ae683b14ed4a8f91c9099,但它是错误的。我需要它返回视图中的友好url。好的,您可以查看
$this->redirect()
,了解控制器如何创建URI。我想你的问题是realurl不工作,因为没有设置页面uid。非常感谢。我解决了这个问题。原因是realurl不起作用。很高兴听到:)