English 中文(简体)
我的环节为何避开了角逐层?
原标题:Why are the angle brackets being escaped in my link?
  • 时间:2011-10-28 10:52:21
  •  标签:
  • php
  • cakephp

我正在产生一个形象的幻灯塔,我想把th子作为链接。 我有以下法典:

$img = $thumbnail->show($options, $tag_options);
echo $this->Html->image("thumbs/".$img);
echo $this->Html->link($this->Html->image("thumbs/".$img),array( controller => images ,  action => view , $image[ Image ][ id ]));

第一份对应声明正确显示形象。 第二种情况显示一种类似情况的联系。

<img src="/app/webroot/img/thumbs/fa741043357d4bf1ca39a58edf351d2a.JPG" alt="" />

如今,这一联系是正确的,因为它需要该形象的页面,但它并没有像我所期望的那样展示形象。 当我看一页源时,链接就看着:

<a href="/index.php/images/view/9">&lt;img src=&quot;/app/webroot/img/thumbs/fa741043357d4bf1ca39a58edf351d2a.JPG&quot; alt=&quot;&quot; /&gt;</a>

我注意到, im角上的gle角被越走。 我做了什么错误?

最佳回答

出于安全原因,在使用<条码><<>条码/代码>方法时,如在<条码>上逃跑的超文本实体。

你有两种选择:

<代码>mage 方法可采用<代码>url作为参数。

echo $this->Html->image( thumbs/  . $img, array( url => 
                                               array( controller => images , 
                                                      action => view , 
                                                      $image[ Image ][ id ])
                                               )
                        );

或您可使用<条码>方法,并在第3条参数中转出(在座标有<条码>>>、<条码>、<条码>id、<条码><>>>

echo $this->Html->link($this->Html->image("thumbs/".$img),
                        array( controller => images , 
                               action => view , $image[ Image ][ id ]),
                        array( escape =>false,  class => example ) // here
                      );
问题回答

暂无回答




相关问题
Brute-force/DoS prevention in PHP [closed]

I am trying to write a script to prevent brute-force login attempts in a website I m building. The logic goes something like this: User sends login information. Check if username and password is ...

please can anyone check this while loop and if condition

<?php $con=mysql_connect("localhost","mts","mts"); if(!con) { die( unable to connect . mysql_error()); } mysql_select_db("mts",$con); /* date_default_timezone_set ("Asia/Calcutta"); $date = ...

定值美元

如何确认来自正确来源的数字。

Generating a drop down list of timezones with PHP

Most sites need some way to show the dates on the site in the users preferred timezone. Below are two lists that I found and then one method using the built in PHP DateTime class in PHP 5. I need ...

Text as watermarking in PHP

I want to create text as a watermark for an image. the water mark should have the following properties front: Impact color: white opacity: 31% Font style: regular, bold Bevel and Emboss size: 30 ...

How does php cast boolean variables?

How does php cast boolean variables? I was trying to save a boolean value to an array: $result["Users"]["is_login"] = true; but when I use debug the is_login value is blank. and when I do ...

热门标签