dou5454954610 2011-05-28 21:17
浏览 65
已采纳

libtidy没有在php工作

I am using libtidy with php. I am using xampp and it shows that tidy support is enabled. But when i use it in my code then it shows the following warning

repairString() [function.repairString]: Could not load configuration file tidy-file.php

i also tried using the object-oriented version but i again got the warning

tidy_repair_string() [function.tidy-repair-string]: Could not load configuration file tidy-file.php

i have kept the tidy code in a separate file called tidy-file.php. it looks like this

$options = array("output-xhtml" => true,"clean" => true, "drop-proprietary-attributes" => true,"drop-font-tags" => true,"drop-empty-paras" => true,"hide-comments" => true); 
function getXHTML($html)
{
$xhtml=tidy_repair_string($html,$options);
return $xhtml;
}

what can be wrong

  • 写回答

1条回答 默认 最新

  • dongruo4601 2011-05-28 21:30
    关注

    From what you've shown here, you're trying to use a variable that's defined outside the function. You need to pull it inside like so:

    function getXHTML($html)
    {
      $options = array("output-xhtml" => true,"clean" => true, "drop-proprietary-attributes" => true,"drop-font-tags" => true,"drop-empty-paras" => true,"hide-comments" => true); 
      $xhtml=tidy_repair_string($html,$options);
      return $xhtml;
    }
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 为什么使用javacv转封装rtsp为rtmp时出现如下问题:[h264 @ 000000004faf7500]no frame?
  • ¥15 乘性高斯噪声在深度学习网络中的应用
  • ¥15 运筹学排序问题中的在线排序
  • ¥15 关于docker部署flink集成hadoop的yarn,请教个问题 flink启动yarn-session.sh连不上hadoop,这个整了好几天一直不行,求帮忙看一下怎么解决
  • ¥30 求一段fortran代码用IVF编译运行的结果
  • ¥15 深度学习根据CNN网络模型,搭建BP模型并训练MNIST数据集
  • ¥15 C++ 头文件/宏冲突问题解决
  • ¥15 用comsol模拟大气湍流通过底部加热(温度不同)的腔体
  • ¥50 安卓adb backup备份子用户应用数据失败
  • ¥20 有人能用聚类分析帮我分析一下文本内容嘛