本文整理汇总了PHP中SimpleXMLIterator::count方法的典型用法代码示例。如果您正苦于以下问题:PHP SimpleXMLIterator::count方法的具体用法?PHP SimpleXMLIterator::count怎么用?PHP SimpleXMLIterator::count使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SimpleXMLIterator
的用法示例。
在下文中一共展示了SimpleXMLIterator::count方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: count
function count()
{
echo __METHOD__ . "\n";
return parent::count();
}
示例2: updateAPP
protected function updateAPP()
{
if (is_file($this->applist) && is_writable($this->applist)) {
try {
$doc = new SimpleXMLIterator($this->applist, null, true);
} catch (Exception $e) {
$this->error[] = "发生异常:" . $e->getMessage() . " 文件:" . $e->getFile() . " 行号:" . $e->getLine();
return false;
}
if ($doc->getName() != "apps") {
$this->error[] = "applist.xml的根元素必须是apps";
return false;
}
$i = $doc->count();
if ($i !== 0) {
$apps = $doc->app;
foreach ($apps as $app) {
if ($app['name'] == $this->app_name) {
$this->error[] = "项目列表存在重名项目,请修改项目名称";
return false;
}
}
}
$doc->addChild("app");
$doc->app[$i]->addAttribute("name", $this->app_name);
$doc->app[$i]->addAttribute("path", $this->app_path);
$doc->app[$i]->addAttribute("index", $this->app_index);
if ($doc->asXML($this->applist)) {
return true;
} else {
$this->error[] = "TinkPHP助手/data/applist.xml 写入失败";
return false;
}
} else {
$this->error[] = "TinkPHP助手/data/applist.xml不存在";
return false;
}
}