看板 PHP 關於我們 聯絡資訊
我要利用PHP讓處理XML+XSL,因為要讓他自動呈現不用自動轉換,所以在網路上找到以下 的程式碼來處理,可是一直會有錯誤Parse error: syntax error, unexpected T_VARIABLE $xmlfile = file_get_contents("C:\\xampp\\htdocs\\xml_search.xml"); $xslfile = file_get_contents("C:\\xampp\\htdocs\\xml_search.xsl"); $arguments=array("/_xml"=>$xmlfile,"/_xsl"=>$xslfile) ; $xh = xslt_create();   $result=xslt_process($xh,"arg:/_xml","arg:/_xsl",NULL,$arguments);   if ($result) { print "SUCCESS, sample.xml was transformed by sample.xsl into the \$result"; print " variable, the \$result variable has the following contents\n<br>\n"; print "<pre>\n"; print $result; print "</pre>\n"; } else { print "Sorry, sample.xml could not be transformed by sample.xsl into"; print " the \$result variable the reason is that " . xslt_error($xh) . print " and the error code is " . xslt_errno($xh); } xslt_free($xh); 我手動轉換是可以正確顯示的,但是想要自動轉換就有問題了 不過我看了超久實在看不出哪裡有問題,麻煩各位幫我看一下 謝謝 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.112.137.56
asdd:找了一整天終於知道php5沒有支援xslt_create() 01/16 02:47
asdd:http://tw2.php.net/manual/en/book.xsl.php 這邊有新作法 01/16 02:48