本文整理汇总了PHP中Location_Model::get_locations方法的典型用法代码示例。如果您正苦于以下问题:PHP Location_Model::get_locations方法的具体用法?PHP Location_Model::get_locations怎么用?PHP Location_Model::get_locations使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Location_Model
的用法示例。
在下文中一共展示了Location_Model::get_locations方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _get_locations
/**
* Get a list of locations
*
* @param array $where Key->value array of the set of filters to apply
* @return string JSON/XML string with the location data
*/
private function _get_locations($where = array())
{
// Fetch the location items
$items = Location_Model::get_locations($where, $this->list_limit);
//No record found.
if ($items->count() == 0) {
return $this->response(4);
}
// Counter
$i = 0;
// To hold the json data
$json_locations = array();
foreach ($items as $item) {
// Needs different treatment depending on the output
if ($this->response_type == 'json') {
$json_locations[] = array("location" => $item);
} else {
$json_locations['location' . $i] = array("location" => $item);
$this->replar[] = 'location' . $i;
}
$i++;
}
// Array to be converted to either JSON or xml
$data = array("payload" => array("domain" => $this->domain, "locations" => $json_locations), "error" => $this->api_service->get_error_msg(0));
return $this->response_type == 'json' ? $this->array_as_json($data) : $this->array_as_xml($data, $this->replar);
}