本文整理汇总了PHP中Validate::isArray方法的典型用法代码示例。如果您正苦于以下问题:PHP Validate::isArray方法的具体用法?PHP Validate::isArray怎么用?PHP Validate::isArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Validate
的用法示例。
在下文中一共展示了Validate::isArray方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
public function index()
{
$this->page();
$flag = false;
if (isset($_GET['sid'])) {
$this->tpl->assign('oneNav', $this->model->findOne());
$this->tpl->assign('prev_url', PREV_URL);
$flag = true;
}
$this->tpl->assign('flag', $flag);
$allNav = $this->model->findAll();
if ($flag) {
$allBrands = $this->brand->getAll();
foreach ($allNav as $key => $value) {
if (!empty($value->brand)) {
$value->brand = unserialize(htmlspecialchars_decode($value->brand));
}
if (Validate::isArray($value->brand)) {
$temp = $value->brand;
$value->brand = '';
foreach ($temp as $val) {
foreach ($allBrands as $k => $v) {
if ($val == $v->id) {
$value->brand[$k] = $v->name;
}
}
}
}
$value->brand = Validate::isArray($value->brand) ? implode(',', $value->brand) : '其他品牌';
}
}
$this->tpl->assign('allNav', $allNav);
$this->tpl->display(ADMIN_STYLE . 'nav/show.tpl');
}
示例2: setFormItem
public static function setFormItem($data, $key, $value)
{
$item = array();
if (Validate::isArray($data)) {
foreach ($data as $v) {
$item[$v->{$key}] = $v->{$value};
}
}
return $item;
}
示例3: filter
public function filter(array $fields)
{
$selectDate = array();
if (Validate::isArray($_POST) && !Validate::isNullArray($_POST)) {
foreach ($_POST as $key => $value) {
if (Validate::inArray($key, $fields)) {
$selectDate[$key] = $value;
}
}
}
return $selectDate;
}
示例4: filter
public function filter(array $_fields)
{
$_selectData = array();
if (Validate::isArray($_POST) && !Validate::isNullArray($_POST)) {
//筛选准备入库的字段和数据
foreach ($_POST as $_key => $_value) {
if (Validate::inArray($_key, $_fields)) {
$_selectData[$_key] = $_value;
}
}
}
return $_selectData;
}
示例5: update
protected function update($where, $updateData, $tables)
{
$isWhere = $setData = '';
foreach ($updateData as $key => $value) {
if (Validate::isArray($value)) {
$setData .= "{$key}={$value['0']},";
} else {
$setData .= "{$key}='{$value}',";
}
}
foreach ($where as $key => $value) {
$isWhere .= $value . ' AND ';
}
$isWhere = substr($isWhere, 0, -4);
$setData = substr($setData, 0, -1);
$sql = "UPDATE {$tables['0']} SET {$setData} WHERE {$isWhere}";
return $this->execute($sql)->rowCount();
}
示例6: getCommendGoods
public function getCommendGoods()
{
$where = array("id='{$this->R['order_id']}'");
$oneGoods = parent::select(array('goods'), array('where' => $where, 'limit' => '1'));
$oneGoods[0]->goods = unserialize(htmlspecialchars_decode($oneGoods[0]->goods));
if (Validate::isArray($oneGoods[0]->goods)) {
foreach ($oneGoods[0]->goods as $key => $value) {
$oneGoods[0]->goods[$key] = unserialize(htmlspecialchars_decode($value));
}
}
$oneGoods = $oneGoods[0]->goods;
return $oneGoods[$this->R['goods_id']];
}
示例7: select
protected function select($_tables, array $_field, array $_param = array())
{
$_limit = '';
$_order = '';
$_where = '';
$_like = '';
if (Validate::isArray($_param) && !Validate::isNullArray($_param)) {
$_limit = isset($_param['limit']) ? 'LIMIT ' . $_param['limit'] : '';
$_order = isset($_param['order']) ? 'ORDER BY ' . $_param['order'] : '';
$_where = '';
if (isset($_param['where'])) {
foreach ($_param['where'] as $_key => $_value) {
$_where .= $_value . ' AND ';
}
$_where = 'WHERE ' . substr($_where, 0, -4);
}
if (isset($_param['like'])) {
foreach ($_param['like'] as $_key => $_value) {
$_like = "WHERE {$_key} LIKE '%{$_value}%'";
}
}
}
$_selectFields = implode(',', $_field);
$_table = isset($_tables[1]) ? $_tables[0] . ',' . $_tables[1] : $_tables[0];
$_sql = "SELECT {$_selectFields} FROM {$_table} {$_where} {$_like} {$_order} {$_limit} ";
$_stmt = $this->execute($_sql);
$_result = array();
while (!!($_objs = $_stmt->fetchObject())) {
$_result[] = $_objs;
}
return Tool::setHtmlString($_result);
}
示例8: setFormItem
public static function setFormItem($_data, $_key, $_value)
{
$_items = array();
if (Validate::isArray($_data)) {
foreach ($_data as $_v) {
$_items[$_v->{$_key}] = $_v->{$_value};
}
}
return $_items;
}
示例9: addIfNotEmpty
/**
* Adds the given key/value pair into array if the value doesn't satisfy empty().
*
* This function just validates that the given $array is actually array. If it's
* NULL the function treats it as array.
*
* @param string $key The key.
* @param string $value The value.
* @param array &$array The array. If NULL will be used as array.
*
* @static
*
* @return none
*/
public static function addIfNotEmpty($key, $value, &$array)
{
if (!is_null($array)) {
Validate::isArray($array, 'array');
}
if (!empty($value)) {
$array[$key] = $value;
}
}
示例10: findUserDetails
public function findUserDetails()
{
$_orderDetails = parent::select(array('id', 'user', 'buildings', 'code', 'address', 'tel', 'name', 'email', 'ordernum', 'date', 'goods', 'refund', 'delivery', 'pay', 'price', 'text', 'ps', 'order_state', 'order_pay', 'order_delivery', 'delivery_url', 'delivery_number', 'delivery_name'), array('where' => array("id='{$this->_R['id']}'")));
$_orderDetails[0]->goods = unserialize(htmlspecialchars_decode($_orderDetails[0]->goods));
if (Validate::isArray($_orderDetails[0]->goods)) {
foreach ($_orderDetails[0]->goods as $_key => $_value) {
$_orderDetails[0]->goods[$_key] = unserialize($_value);
}
}
return $_orderDetails;
}