我正在使用CakePHP,并希望创建一个控制器/视图的URL,而不包括锚标记.
换句话说,如果我使用
$this->Html->link('foo',array('controller'=>'bar','action'=>'display'));
Run Code Online (Sandbox Code Playgroud)
然后输出是一个格式化的链接,可以显示...但我只是想要没有围绕它的HTML的URL.
dec*_*eze 12
echo $this->Html->url(array('controller' => 'bar', 'action' => 'display'));
Run Code Online (Sandbox Code Playgroud)
使用可选的第二个参数使其成为完整的URL,包括http://等等:
echo $this->Html->url(array('controller' => 'bar', 'action' => 'display'), true);
Run Code Online (Sandbox Code Playgroud)