Php app42后端即服务
我一直在尝试将我的web应用程序连接到BaaS,名为app42-apphq.shephertz.com 有关于如何做的指南吗?我已经尝试阅读文档,并且已经连接,但是问题是显示对我的视图的json响应,因为响应是通过两个数组循环的 这是我的控制器功能Php app42后端即服务,php,laravel-4,app42,Php,Laravel 4,App42,我一直在尝试将我的web应用程序连接到BaaS,名为app42-apphq.shephertz.com 有关于如何做的指南吗?我已经尝试阅读文档,并且已经连接,但是问题是显示对我的视图的json响应,因为响应是通过两个数组循环的 这是我的控制器功能 $storageService = App42API::buildStorageService(); $inventory = $storageService->findAllDocuments($dbName,$collectionN
$storageService = App42API::buildStorageService();
$inventory = $storageService->findAllDocuments($dbName,$collectionName);
$jsonDocList = $inventory->getJsonDocList();
foreach( $jsonDocList as $jsonDoc )
{
$products = json_decode($jsonDoc->getJsonDoc());
for($i=0;$i<=count($products);$i++)
{
print($products->productDescription);
print($products->productName);
print($products->productPrice);
}
}
$storageService=App42API::buildStorageService();
$inventory=$storageService->findAllDocuments($dbName,$collectionName);
$jsonDocList=$inventory->getJsonDocList();
foreach($jsonDocList作为$jsonDoc)
{
$products=json_解码($jsonDoc->getJsonDoc());
对于($i=0;$iproductDescription);
打印($products->productName);
打印($products->productPrice);
}
}
这就是我的观点
@extends('templates.home.another')
@section('content')
<div class="container" style="margin-left:270px; width:70%; margin- top:60px;">
<div class="col-lg-8">
<table id="app42sales" class=" table table-striped" >
<thead>
<tr>
<th>ID</th>
<th>Transaction Type</th>
<th>Number of items</th>
<th>Total Cost</th>
<th>Week of year</th>
<th>Year</th>
<th>Date</th>
<th>Date of year</th>
</tr>
</thead>
<tbody>
@foreach($jsonDoc as $doc)
{
@foreach($records as $record)
<?php $i = 1; ?>
<tr>
<td>{{ $i }}</td>
<td>{{ $record->transactionType }}</td>
<td>{{ $record->numberOfItems }}</td>
<td>{{ $record->totalCost }}</td>
<td>{{ $record->weekOfYear }}</td>
<td>{{ $record->year }}</td>
<td>{{ $record->date }}</td>
<td>{{ $record->dayOfYear }}</td>
</tr>
<?php $i++ ;?>
@endforeach
}
@endforeach
</tbody>
</table>
</div>
</div>
@endsection
@extends('templates.home.other'))
@节(“内容”)
身份证件
交易类型
项目数
总成本
一年中的一周
年
日期
年份日期
@foreach($jsonDoc作为$doc)
{
@foreach($记录为$记录)
{{$i}
{{$record->transactionType}
{{$record->numberOfItems}
{{$record->totalCost}
{{$record->weekOfYear}
{{$record->year}
{{$record->date}
{{$record->dayOfYear}
@endforeach
}
@endforeach
@端部
我希望这对您有所帮助
控制器
$storageService = App42API::buildStorageService();
$inventory = $storageService->findAllDocuments($dbName,$collectionName);
$jsonDocList = $inventory->getJsonDocList();
foreach( $jsonDocList as $jsonDoc )
{
$products = json_decode($jsonDoc->getJsonDoc());
}
看法
@extends('templates.home.other'))
@节(“内容”)
身份证件
交易类型
项目数
总成本
一年中的一周
年
日期
年份日期
@foreach($products as$记录)
{
}
@endforeach
@端部
@extends('templates.home.another')
@section('content')
<div class="container" style="margin-left:270px; width:70%; margin- top:60px;">
<div class="col-lg-8">
<table id="app42sales" class=" table table-striped" >
<thead>
<tr>
<th>ID</th>
<th>Transaction Type</th>
<th>Number of items</th>
<th>Total Cost</th>
<th>Week of year</th>
<th>Year</th>
<th>Date</th>
<th>Date of year</th>
</tr>
</thead>
<tbody>
<?php $i = 1; ?>
@foreach($products as $record)
{
<tr>
<td><?php echo $i; ?></td>
<td><?php echo $record['transactionType']; ?></td>
<td><?php echo $record['numberOfItems']; ?></td>
<td><?php echo $record['totalCost']; ?></td>
<td><?php echo $record['weekOfYear']; ?></td>
<td><?php echo $record['year']; ?></td>
<td><?php echo $record['date']; ?></td>
<td><?php echo $record['dayOfYear']; ?></td>
</tr>
<?php $i++ ;?>
}
@endforeach
</tbody>
</table>
</div>
</div>
@endsection