English 中文(简体)
背 景
原标题:apostrophe php issue

我正在用一个叫喊的盒子进行学校分配。 发现大管治用了 j、aj、米s和 php。 下面的句子就是一个小问题:

$result .= "<li><strong>".$row[ user ]."</strong><img src="" alt=""-""    />".$row[ message ]." <span class=""date"">".$row[ date ]."</span></li>";}

我很想知道,是否有任何人能够发现造成错误的原因。 到目前为止,我得出这一结论:<代码>$row[电文],然后认为该守则的其余部分是示意图。 因此,这很可能是一个外向问题。

最佳回答

仅为了方便您的生活,请在网站上查阅网站,并在网站上填写<>>>。

$result .=  <li><strong> .$row[ user ]. </strong><img src="" alt=""/> .$row[ message ].  <span class="date"> .$row[ date ]. </span></li> ;

Pretty sure you should get the idea.

问题回答
$result .= "<li><strong>{$row[ user ]}</strong><img src= http://www.  alt= My Alt Tag  />{$row[ message ]}<span class= date >{$row[ date ]}</span></li>";

您通过引述和引用来重新混淆生态,你可以把变数排在{}上,以便在这种情形下强行进行干涉。

$result .= "<li><strong>".$row[ user ]."</strong><img src=   alt= - />".$row[ message ]." <span class= date >".$row[ date ]."</span></li>";}

Avoid using " inside of the string - it is easy to forget about escaping special chars. Instead of " use . Besides - you use " only when there is any PHP parsing necessary within this string. E.g.

$var1 = 1;
$test = "$var1"; //evaluates to  1 
$test =  $var1 ; //evaluates to  $var1 

It appears that you are attempting to escape quotes and making your job harder. A great feature in PHP for HTML output is using quoted strings so that you don t have to worry about escaping double quotes. Please reference the PHP Manual for Strings.

换言之,你的行文是:

 $result .=  <li><strong>  . $row[ user ] .  </strong><img src="" alt="-" />  . $row[ message ] .
             <span class="date">  . $row[ date ] .  </span></li>  .
             <li><strong>  . $row[ user ] .  </strong><img src="" alt="-" />  . $row[ message ] . 
             <span class="date">  . $row[ date ] .  </span></li> ;




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