0
我正在使用https://github.com/feelinglucky/php-readability,我可以让作者的例子工作。但是,当我创建自己的时候,它只是输出url。有人知道我的代码有什么问题吗?PHP可读性无法正常工作
这里是我的代码:
<?php
require 'lib/Readability.inc.php';
$source = 'http://techcrunch.com/2011/04/02/conduit-acquires-web-application-platform-wibiya-for-45-million-sources/';
$Readability = new Readability($source, $html_input_charset); //default charset is utf-8
$ReadabilityData = $Readability->getContent();
$title = $ReadabilityData['title'];
$content = $ReadabilityData['content'];
?>
<html>
<head>
<title>test - <?php echo $title; ?></title>
</head>
<body>
<?php
echo "<h1>". $title."</h1> ";
echo $content;
?>
</body>
</html>
,这是输出我得到:
<html>
<head>
<title>test - </title>
</head>
<body>
<h1></h1> <body contentScore="105"><p>http://techcrunch.com/2011/04/02/conduit-acquires-web-application-platform-wibiya-for-45-million-sources/</p></body>
</body>
</html>