當前位置: 首頁>>代碼示例>>PHP>>正文


PHP category::getallcategory方法代碼示例

本文整理匯總了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;
    }
}
開發者ID:sherif700,項目名稱:ourWork,代碼行數:31,代碼來源:category_server.php

示例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++) {
開發者ID:sherif700,項目名稱:ourWork,代碼行數:31,代碼來源:category.php


注:本文中的category::getallcategory方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。