本文整理汇总了PHP中product::getAllProduct方法的典型用法代码示例。如果您正苦于以下问题:PHP product::getAllProduct方法的具体用法?PHP product::getAllProduct怎么用?PHP product::getAllProduct使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类product
的用法示例。
在下文中一共展示了product::getAllProduct方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: api_autoloader
function api_autoloader($class_name)
{
$directory = '../class/';
if (file_exists($directory . $class_name . '.class.php')) {
require_once $directory . $class_name . '.class.php';
return;
}
}
spl_autoload_register('api_autoloader');
//$app = \Slim\Slim::getInstance();
//$db = new dbHelper();
$db = new db(DB_SERVER, DB_USERNAME, DB_PASSWORD, DB_DATABASE);
// Products
$app->get('/products', function () {
$product = new product();
$response = $product->getAllProduct();
echoResponse(200, $response);
});
$app->post('/products', function () use($app) {
$product = new product();
$data = json_decode($app->request->getBody(), TRUE);
$id = $product->AddProduct($data);
echoResponse(200, $id);
});
$app->put('/products/:id', function ($id) use($app) {
$product = new product();
$data = json_decode($app->request->getBody(), TRUE);
$result = $product->updateProduct($id, $data);
// $rows["message"] = "Product information updated successfully.";
echoResponse(200, $result);
});
示例2: product
<?php
require_once '../models/class-product.php';
//require_once('../models/class-cat-product.php');
require_once '../models/class-phan-trang.php';
$product_obj = new product();
$config = array('current_page' => isset($_GET['page']) ? $_GET['page'] : 1, 'total_record' => $product_obj->countTable('product'), 'limit' => 3, 'link_full' => 'index.php?view=list-product&page={page}', 'link_first' => 'index.php?view=list-product', 'range' => 9);
$start = ($config['current_page'] - 1) * $config['limit'];
$sort = '';
if (isset($_GET['sort'])) {
$sort = $_GET['sort'];
}
switch ($sort) {
case 'pro_name':
$a = $product_obj->getAllProduct('pro_name', array($start, $config['limit']));
break;
default:
$a = $product_obj->getAllProduct('', array($start, $config['limit']));
}
?>
<table class="table table-bordered table-striped table-condensed flip-content">
<thead class="flip-content">
<tr>
<th>STT</th>
<th><a href="index.php?view=list-news&sort=title">Sản phẩm</a></th>
<th class="numeric">Ảnh</th>
<th class="numeric">Mã</th>
<th class="numeric">Màu sắc</th>
<th class="numeric">Giá niêm yết</th>
<th width="10%" class="numeric">Ngày đặt</th>
<th class="numeric">Giá sale</th>