我在PHP中有点生锈,目前正在努力做一些非常简单的事情.
$value = "PUPPY";
$html .= '<td>{$value}</td>';
echo $html; // Doesn't work, prints {$value}.... Should be... PUPPY
Run Code Online (Sandbox Code Playgroud)
我知道有一种简单的方法可以做到这一点,但我忘记了,无法在Google或StackOverflow上找到明确的方法.
一旦完成,我需要将html放在一个变量中,它被tcpdf :: writeHtml()使用
我已经尝试过:
$html .= "<td align='right' nowrap>".$value."</td>";
echo $html; // But this outputs a TD tag with attribute nowrap="" and this is not valid HTML... tcpdf:writeHtml rejects this.
Run Code Online (Sandbox Code Playgroud)
更新:该错误实际上是由于前一段时间弃用的"nowrap"属性的错误使用造成的.
Ora*_*ill 13
单引号字符串不在php中插入.请改用双引号.
$value = "PUPPY";
$html .= "<td>{$value}</td>";
echo $html;
Run Code Online (Sandbox Code Playgroud)
$value = "PUPPY";
$html .= "<td>{$value}</td>";
echo $html;
Run Code Online (Sandbox Code Playgroud)
用"而不是'
看看吧 documentation about Strings on PHP
| 归档时间: |
|
| 查看次数: |
9579 次 |
| 最近记录: |