我想打开另一个url,让我们说:'cakephp'中的'localhost/test.html'。如何在cakephp的新选项卡中打开外部URL?
我已经有一个视图(page.ctp)和控制器(PagesController.php)。在这个页面上有一个名为Wireshark的按钮,每当我点击这个按钮,我想去另一个URL但不想重定向到cakePHP服务器中的另一个页面。
在page.ctp我用这个:
<?php echo $this->Html->link(__('Wireshark'), array('controller' => 'tests','action' => 'wireshark'))?>
在TestsController:
<?php
App::uses('AppController', 'Controller');
class TestsController extends AppController {
public function wireshark() {
}
}
在wireshark.ctp:
<?php
echo "hello"
?>
直到现在,当我点击按钮,它将我重定向到“http://localhost:9877/tests/wireshark”并显示“hello”。我认为它工作正常,但我需要的是去另一个网页(localhost/test.html)。
我也试图与这个在同一个文件:
<?php echo $this->Html->link(__('Wireshark'), 'localhost/test.html')?>
我得到这个,当我使用上面的代码:
Error: The requested address '/pages/localhost/test.html' was not found on this server.
我完全新的和自我学习CakePHP的。我搜索了一下,但没有任何一篇文章向我详细解释如何做到这一点(可能是因为我对此很陌生)。
任何人都可以帮助我这个。如果不清楚请向我澄清,我很抱歉。
谢谢
谢谢它工作:)。我想我没有使用http://。使用http后,它现在正在工作。谢谢 – Sheenam