English 中文(简体)
http://www.un.org
原标题:<br /> and highlight_string

我想在浏览器上显示代码,而不是加以执行,因此我使用highlight_string

<?php highlight_string( function foo(items) {
    for (var i=0; i<items.length; i++) {
        alert(items[i] + "juhu");
    }   // Real Tab.
} )?>

回返

<code><span style="color: #000000"> function&nbsp;foo(items)&nbsp;{ <br />&nbsp;&nbsp;&nbsp;&nbsp;for&nbsp;(var&nbsp;i=0;&nbsp;i&lt;items.length;&nbsp;i++)&nbsp;{ <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;alert(items[i]&nbsp;+&nbsp;"juhu"); <br />&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;Real&nbsp;Tab. <br />}</span> </code>

<code>

但我是在new Line no<br/>之后的。

<code><span style="color: #000000">

function&nbsp;foo(items)&nbsp;{
&nbsp;&nbsp;&nbsp;&nbsp;for&nbsp;(var&nbsp;i=0;&nbsp;i&lt;items.length;&nbsp;i++)&nbsp;{

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;alert(items[i]&nbsp;+&nbsp;"juhu");

&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;Real&nbsp;Tab.

}</span>

</code>

是否可能?

最佳回答

You should be able to replace every <br /> tag with normal linebreaks ( ) and output your string, like this:

$data = highlight_string( function foo(items) {
for (var i=0; i<items.length; i++) {
    alert(items[i] + "juhu");
}   // Real Tab.
} ,true);
 $data = str_replace( <br /> ,"
",$data);
 echo  <pre> ;
 echo $data;
 echo  </pre> ;
问题回答

因此,你不会试图发挥习俗作用。 视体为参数,通过返回来挖掘梯度,强调在 lo的子体上加强功能,然后将所有次座标汇成所需的座标。





相关问题
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 ...

热门标签