(PHP 5, PHP 7, PHP 8, PECL tidy >= 0.5.2)
tidy::getOpt -- tidy_getopt — Returns the value of the specified configuration option for the tidy document
面向对象风格
过程化风格
Returns the value of the specified option for the
specified tidy tidy.
tidyThe Tidy 对象。
optionYou will find a list with each configuration option and their types at: » http://api.html-tidy.org/#quick-reference.
Returns the value of the specified option.
The return type depends on the type of the specified one.
示例 #1 tidy_getopt() example
<?php
$html ='<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2//EN">
<html><head><title>Title</title></head>
<body>
<p><img src="img.png"></p>
</body></html>';
$config = array('accessibility-check' => 3,
'alt-text' => 'some text');
$tidy = new tidy();
$tidy->parseString($html, $config);
var_dump($tidy->getOpt('accessibility-check')); //integer
var_dump($tidy->getOpt('lower-literals')); //boolean
var_dump($tidy->getOpt('alt-text')); //string
?>以上示例会输出:
int(3) bool(true) string(9) "some text"