开发者

xslt_create() with PHP5

开发者 https://www.devze.com 2023-02-09 10:32 出处:网络
I am currently trying to display a RSS feed in a PHP page, but it seems to have a problem between the xslt_create() function and PHP5.

I am currently trying to display a RSS feed in a PHP page, but it seems to have a problem between the xslt_create() function and PHP5.

<?php

$xh = xslt_create();

$file=fopen(WEB_DIR . 'assets/_xml/rss.xml','r');
$xml=fread($file,16384);
fclose($file);

$file=fopen(WEB_DIR . 'assets/_xml/rss.xslt','r');
$xsl=fread($file,16384);
fclo开发者_开发知识库se($file);

$arguments = array(
  '/_xml' => $xml,
  '/_xsl' => $xsl
  );

$result = xslt_process($xh, 'arg:/_xml', 'arg:/_xsl', NULL, $arguments);

xslt_free($xh);

print "$result";
?>

I get the error

Fatal error: Call to undefined function xslt_create() in

What do I have to do to correct this issue ?


xslt_create only exists in PHP 4 - as this approach to parsing XML was removed in PHP 5.

As such, I'd recommend updating your code to use one of the current PHP 5 approaches as listed within the XML Manipulation section of the manual. (The XSL extension provides a XSLTProcessor class that is probably the nearest direct equivalent.)

0

精彩评论

暂无评论...
验证码 换一张
取 消