本文整理匯總了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;
}
}