本文整理汇总了PHP中category::getallcategory方法的典型用法代码示例。如果您正苦于以下问题:PHP category::getallcategory方法的具体用法?PHP category::getallcategory怎么用?PHP category::getallcategory使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类category
的用法示例。
在下文中一共展示了category::getallcategory方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: category
$errors[] = "the category is already exist";
$_SESSION['errors'] = $errors;
}
if (empty(trim($_GET['desc']))) {
$errors[] = "the desc is empty";
$_SESSION['errors'] = $errors;
}
if (empty($errors)) {
$category->category_name = $_GET['name'];
$category->category_desc = $_GET['desc'];
$category->insert();
}
$data = $category->getallcategory();
$response1 = [];
$response1[] = $data;
$response1[] = $errors;
$jsondata = json_encode($response1);
echo $jsondata;
// $category = new category();
// $category->category_name = $_GET['name'];
// $category->category_desc = $_GET['desc'];
// $category->insert();
// $data = $category->getallcategory();
// $jsondata = json_encode($data);
// echo $jsondata;
} else {
$cat = new category();
$jsondata = json_encode($cat->getallcategory());
echo $jsondata;
}
}
示例2: category
<div class="panel panel-default sidebar-menu">
<div class="panel-heading">
<h3 class="panel-title">Categories</h3>
</div>
<div class="panel-body">
<ul class="nav nav-pills nav-stacked category-menu">
<?php
include "../category.php";
include "../sub-category.php";
?>
<?php
$cat = new category();
$data = $cat->getallcategory();
$sub = new subcategory();
for ($i = 0; $i < count($data); $i++) {
?>
<li>
<a href="category.php?cat_id=<?php
echo $data[$i]['category_id'];
?>
"><?php
echo $data[$i]['category_name'];
?>
<span class="badge pull-right">42</span></a>
<ul>
<?php
$subdata = $sub->getsubbycat($data[$i]['category_id']);
for ($j = 0; $j < count($subdata); $j++) {