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>