当前位置: 首页>>代码示例>>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;未经允许,请勿转载。