上帝我累了...我的大腦不工作,我需要一些幫助!爲什麼我的PHP生成的表格單元格產生這種奇怪的HTML
爲什麼下面的代碼:
function buildDeleteForm($deleteUrl,$searchArray) {
print ("<form target=\"_self\" method=\"post\">\n");
print ("<input type=\"hidden\" name=\"delUrl\" value=\"" . $deleteUrl . "\" />\n");
print ("<input type=\"hidden\" name=\"url\" value=\"" . $searchArray . "\" />\n");
print ("<input type=\"submit\" name=\"delete\" value=\"delete\" />\n</form>\n");
}
foreach ($urls as $url) {
$url = preg_replace('/\s+/', '', $url);
print("<tr><td>" . $url . "</td>");
$response = sendRestRequest($url,$type);
$status = $response['http_code'];
if ($status == 200) {
// build the form
print("<td class=\"result\"><img src=\"200.png\"></td><td class=\"right\">" . buildDeleteForm($url,$urllist) . "</td></tr>");
} elseif ($status == 404) {
print("<td class=\"result\"><img src=\"404.png\"></td><td class=\"right\"> </td></tr>");
} else {
print("<td class=\"result\"><img src=\"error.png\"></td><td class=\"right\">" . $status . "</td></tr>");
}
}
產生這種瘋狂的HTML
<tr>
<td>
http://someserver4017.site.com/resources/datacaches/xi50cache/xi50cache_RetailItemCommunication_se.LUT/sv_art_40101790
</td>
<form target="_self" method="post">
<input type="hidden" name="delUrl" value="http://someserver4017.site.com/resources/datacaches/xi50cache/xi50cache_RetailItemCommunication_se.LUT/sv_art_40101790" />
<input type="hidden" name="url" value="http://someserver4017.site.com/resources/datacaches/xi50cache/xi50cache_RetailItemCommunication_se.LUT/sv_art_40101790,http://someserver4018.site.com/resources/datacaches/xi50cache/xi50cache_RetailItemCommunication_se.LUT/sv_art_40101790,http://someserver4020.site.com/resources/datacaches/xi50cache/xi50cache_RetailItemCommunication_se.LUT/sv_art_40101790" />
<input type="submit" name="delete" value="delete" />
</form>
<td class="result">
<img src="200.png">
</td>
<td class="right">
</td>
</tr>
它完全採取的形式出來的表格單元格的......我能理解,如果它只是一個CSS東西,但這是實際生成的源代碼完全奇怪。我知道這是一些簡單的,我只是不明白,並期待愚蠢 - 但嘿,我只是想東西的工作:)
Doh !!看到我告訴你我會看起來很愚蠢:)現在,它完成了,浪費時間:)謝謝! – Seer 2012-03-02 15:27:03