本文整理匯總了PHP中Items::all方法的典型用法代碼示例。如果您正苦於以下問題:PHP Items::all方法的具體用法?PHP Items::all怎麽用?PHP Items::all使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Items
的用法示例。
在下文中一共展示了Items::all方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: all
/**
* @name all
* @description get all items
* @return mixed
*/
private function all()
{
$items = new Items();
if ($itemsData = $items->all()) {
return $this->response($itemsData, '');
}
return $this->response('', "Could not get the items", true);
}
示例2: json_encode
<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);
// include the items class
include_once '../classes/concertClass.php';
// response
$response = array('error' => true, 'message' => '');
$items = new Items();
if ($allItems = $items->all()) {
$response['error'] = false;
$response['data'] = $allItems;
}
// response
echo json_encode($response);
示例3: Items
<?php
/**
* @name table.php
* @description prints all the inventary items inside a table
*/
require_once 'src/classes/ItemsClass.php';
// instace of the items
$items = new Items();
// get all items on the database
$myItems = $items->all();
// print the table
echo '<table class="table">
<thead>
<tr>
<th>ID</th>
<th>Name</th>
<th>Created</th>
<th>Updated</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
';
foreach ($myItems as $key => $item) {
echo '<tr id="' . $item['id'] . '">
<td>
' . $item['id'] . '
</td>
<td>