Rumah > Artikel > pembangunan bahagian belakang > php拼字符串 请问
php拼字符串 请教
每次拼字符串,感觉头大。 因为没有这坏习惯
在改一段老代码
引用一个js方法,如下
<?php<br /> function base_url(){<br /> return "http://base/";<br /> }<br /><br /> $value = array(<br /> 'userid' => 1,<br /> 'realname' => 'name',<br /> 'mobile' => '13590909090',<br /> 'gender' => '1',<br /> 'idnumber' => 'idnum',<br /> 'passportnu' => 'passport',<br /> );<br /> $intserial = 'ang?';<br /><br /> echo "<tr><br /> <td>$intserial</td><br /> <td><a href='" . base_url() . "team/alterinfo?id=" . $value['userid'] . "'>" . $value['realname']."</a></td><br /> <td>" . $value['mobile'] . "</td><td>" . $value['gender'] . "</td><br /> <td>" . $value['idnumber'] . " " . $value['passportnu'] . "</td><br /> <td><a href='javascript:confirmDelete(\"" . base_url() . "team/deletemember?id=" . $value['userid'] . "\",'confirm delet e?')'>delete</a></td><br /> </tr>";
$str = "<tr>";<br />$str .= "<td>$intserial</td>";<br />$str .= "<td><a href='" . base_url() . "team/alterinfo?id=" . $value['userid'] . "'>" . $value['realname']."</a></td>";<br />$str .= "<td>" . $value['mobile'] . "</td><td>" . $value['gender'] . "</td>";<br />$str .= "<td>" . $value['idnumber'] . " " . $value['passportnu'] . "</td>";<br />$str .= "<td><a href='javascript:confirmDelete(\"" . base_url() . "team/deletemember?id=" . $value['userid'] . "\",\"confir m delete?\")'>delete</a></td>";<br />$str .= "</tr>";<br /><br />echo $str;