本文整理匯總了PHP中tidy::parseFile方法的典型用法代碼示例。如果您正苦於以下問題:PHP tidy::parseFile方法的具體用法?PHP tidy::parseFile怎麽用?PHP tidy::parseFile使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類tidy
的用法示例。
在下文中一共展示了tidy::parseFile方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: parseFile
public function parseFile($filename, $config = null, $encoding = 'utf8', $use_include_path = false)
{
parent::parseFile($filename, $this->config + (array) $config, $encoding, $use_include_path);
}
示例2: array
$config = array('indent' => true, 'input-xml' => true, 'output-xml' => true, 'wrap' => false);
$files = scandir('.');
$qnumber = 0;
foreach ($files as $file) {
if (strpos($file, "question") === false) {
continue;
}
if (strpos($file, ".xml") === false) {
continue;
}
$qnumber++;
// if ( $qnumber <= 5 ) continue;
// echo("+++++++++++++\n$$file $qnumber\n");
// Tidy
$tidy = new tidy();
$tidy->parseFile($file, $config);
$tidy->cleanRepair();
// Output
// echo tidy_get_output($tidy);
$DOM = simplexml_load_string(tidy_get_output($tidy));
// echo $DOM->asXML();
$itemBody = $DOM->itemBody;
$div = $itemBody->div;
$question_text = $div->asXML();
// Get rid of some crap..
$question_text = str_replace(array('<p/>', '<div/>'), array('', ''), $question_text);
// Uh lets say good by to <spans...>
$question_text = preg_replace('/<span.*?>/', '', $question_text);
$question_text = preg_replace('/<\\/span>/', '', $question_text);
$question_text = trimBlankLines($question_text);
// Pull out the mneme way of indicating short answer.