我想根据条件禁用对话框中出现的按钮.问题是如何通过对话框动态生成按钮来访问按钮?
在对话框中生成的html代码:
<button type="button" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" role="button" aria-disabled="true">
<span> class="ui-button-text">Save</span>
</button>
Run Code Online (Sandbox Code Playgroud) 我正在做一些php html解析,这是我现在的代码
function get_tag($htmlelement,$attr, $value, $xml ,$arr) {
$attr = preg_quote($attr);
$value = preg_quote($value);
if($attr!='' && $value!='')
{
$tag_regex = '/<'.$htmlelement.'[^>]*'.$attr.'="'.$value.'">(.*?)<\\/'.$htmlelement.'>/si';
preg_match($tag_regex,$xml,$matches);
}
else
{
$tag_regex = '/'.$htmlelement.'[^>]*"(.*?)\/'.$htmlelement.'/i';
preg_match_all($tag_regex,$xml,$matches);
}
if($arr)
return $matches;
else
return $matches[1];
}
$htmlcontent = file_get_contents("doc.html");
$extract = get_tag('tbody','id', 'open', $htmlcontent,false);
$trows = get_tag('tr','', '', $htmlcontent,false);
Run Code Online (Sandbox Code Playgroud)
可以在http://pastebin.com/ydiAdiuC上查看必须解析的行/ $ extract中的内容.
基本上,我正在阅读html内容并从html获取标签tbody.现在我想在tbody中获取每个tr和td值并在我的页面中使用它.任何想法如何使用,我想我没有使用正确的方法来实现preg_match_all.