-3

この JavaScript を PHP に相当するものは何ですか? このjavascriptコードをphpに変換したい...私は主にこれに興味があります:

  1. -getElementsByTagName
  2. -document.write("")
  3. -ファイル名として「変数」を使用してドキュメントを作成します。

コードの一部を次に示します。

document.write("<table border='1'>");
  var x=xmlDoc.getElementsByTagName("title");
  for (i=0;i<x.length;i++)
  { 
  document.write("<tr><td>");
  document.write(x[i].getElementsByTagName("artist")[0].childNodes[0].nodeValue);
  document.write("</td><td>");
  document.write(x[i].getElementsByTagName("title")[0].childNodes[0].nodeValue);
  document.write("</td></tr>");
 }
document.write("</table>");

お時間をいただきありがとうございます!

4

1 に答える 1

1

おそらくSimpleXMLを調べたいと思うでしょう。そこからxpathを使用して、必要なデータをクエリします。

于 2013-10-24T19:47:07.027 に答える