PHP可读性不起作用
我正在使用,我能够让作者的例子发挥作用。但是,当我创建自己的url时,它只输出url。有人知道我的代码有什么问题吗 这是我的密码:PHP可读性不起作用,php,Php,我正在使用,我能够让作者的例子发挥作用。但是,当我创建自己的url时,它只输出url。有人知道我的代码有什么问题吗 这是我的密码: <?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
<?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>
测试-
http://techcrunch.com/2011/04/02/conduit-acquires-web-application-platform-wibiya-for-45-million-sources/
我正在寻找的输出如下所示:
您应该向它提供一个html文档
$source = 'http://techcrunch.com/2011/04/02/conduit-acquires-web-application-platform-wibiya-for-45-million-sources/';
$html = file_get_contents($source);
$Readability = new Readability($html, $html_input_charset);
...
你应该给它一个html文档
$source = 'http://techcrunch.com/2011/04/02/conduit-acquires-web-application-platform-wibiya-for-45-million-sources/';
$html = file_get_contents($source);
$Readability = new Readability($html, $html_input_charset);
...