CakePHP:如何使用html anchor <a> ... </a>重定向到新网页?

shi*_*bly 0 php anchor cakephp hyperlink cakephp-1.3

评论表=>

echo $this->Form->create('Comment',array('url'=>array('controller' => 'comments', 'action' =>'add', $listposts['Post']['id']) ) );

echo $this->Form->input('post_id',array('type'=>'hidden','style'=>'width:30%','value'=>$listposts['Post']['id']));  
echo $this->Form->input('name',array('style'=>'width:30%'));
echo $this->Form->input('email',array('style'=>'width:30%'));   
echo $this->Form->input('body',array('rows'=>'5'));

echo $this->Form->end('Comment');
Run Code Online (Sandbox Code Playgroud)

在注释表单的正文字段中,如果我输入这样=>

<a href="www.google.com"> google </a>
Run Code Online (Sandbox Code Playgroud)

我在该网页上获得了一个"google"链接,但如果我点击该链接,则不会重定向到www.google.com.为什么不重定向?

如果我悬停那个链接,我看到=>

http://www.mysite.com/posts/view/www.google.com
Run Code Online (Sandbox Code Playgroud)

如何点击该链接重定向到www.google.com?

Jef*_*Day 5

您需要将网址设为"http://www.google.com".因为没有协议说明符,所以它将href字段解释为相对链接而不是指向另一个域的链接.