本文整理汇总了PHP中Arrays::merge方法的典型用法代码示例。如果您正苦于以下问题:PHP Arrays::merge方法的具体用法?PHP Arrays::merge怎么用?PHP Arrays::merge使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Arrays
的用法示例。
在下文中一共展示了Arrays::merge方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: load
function load()
{
foreach ($_ENV['aliasesFiles'] as $file) {
$extract = Files::inc($file, null, null, array('aliases'));
$this->aliases = Arrays::merge($this->aliases, $extract['aliases']);
}
}
示例2: id
/**
@param additional additional fields to merge with where on insert
*/
protected function id($table, $where, $additional = null)
{
$sql = $this->select($table, $where, 'id');
$id = $this->row($sql);
if (!$id) {
if ($additional) {
$where = Arrays::merge($where, $additional);
}
$id = $this->insert($table, $where);
}
return $id;
}
示例3: validate
function validate($fields, $options = null)
{
if ($this->fieldValidaters) {
$fields = Arrays::merge($this->fieldValidaters, $fields);
}
return $this->filterAndValidate($fields, $options);
}
示例4: setRequestOptions
protected function setRequestOptions($url, $method, $vars, $files = null)
{
$purl = parse_url($url);
if ($purl['scheme'] == 'https') {
curl_setopt($this->request, CURLOPT_PORT, empty($purl['port']) ? 443 : $purl['port']);
if ($this->validate_ssl) {
curl_setopt($this->request, CURLOPT_SSL_VERIFYPEER, true);
curl_setopt($this->request, CURLOPT_CAINFO, dirname(__FILE__) . '/cacert.pem');
} elseif ($this->ignore_ssl) {
curl_setopt($this->request, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($this->request, CURLOPT_SSL_VERIFYHOST, 0);
} else {
curl_setopt($this->request, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($this->request, CURLOPT_SSL_VERIFYHOST, 2);
}
}
$method = strtoupper($method);
switch ($method) {
case 'HEAD':
curl_setopt($this->request, CURLOPT_NOBODY, true);
break;
case 'GET':
curl_setopt($this->request, CURLOPT_HTTPGET, true);
break;
case 'PUT':
curl_setopt($this->request, CURLOPT_CUSTOMREQUEST, "PUT");
$toPost = true;
break;
case 'POST':
curl_setopt($this->request, CURLOPT_POST, true);
$toPost = true;
break;
default:
curl_setopt($this->request, CURLOPT_CUSTOMREQUEST, $method);
}
curl_setopt($this->request, CURLOPT_URL, $url);
if ($files || !empty($vars)) {
if (!$toPost) {
throw new InvalidArgumentException('POST-vars may only be set for a POST or PUT Request.');
}
if (!is_array($vars)) {
curl_setopt($this->request, CURLOPT_POSTFIELDS, $vars);
} elseif ($files) {
foreach ($files as &$file) {
if ($file[0] != '@') {
$file = '@' . $file;
}
}
unset($file);
curl_setopt($this->request, CURLOPT_POSTFIELDS, Arrays::merge($files, $vars));
} else {
curl_setopt($this->request, CURLOPT_POSTFIELDS, Http::buildQuery($vars));
}
} elseif ($toPost) {
throw new InvalidArgumentException('POST-vars must be set for a POST-Request.');
}
# Set some default CURL options
curl_setopt($this->request, CURLOPT_HEADER, true);
curl_setopt($this->request, CURLOPT_RETURNTRANSFER, true);
curl_setopt($this->request, CURLOPT_USERAGENT, $this->user_agent);
curl_setopt($this->request, CURLOPT_TIMEOUT, $this->timeout);
if ($this->cookie_file) {
curl_setopt($this->request, CURLOPT_COOKIEFILE, $this->cookie_file);
curl_setopt($this->request, CURLOPT_COOKIEJAR, $this->cookie_file);
}
/* relative paths fix, see requestFix
if ($this->follow_redirects){
curl_setopt($this->request, CURLOPT_FOLLOWLOCATION, true);
}
*/
if ($this->referrer) {
curl_setopt($this->request, CURLOPT_REFERER, $this->referrer);
}
# Set any custom CURL options
foreach ($this->options as $option => $value) {
curl_setopt($this->request, $option, $value);
}
}
示例5: append
function append($part, $concern, $crudType = null)
{
$crudType = $this->getCrudType($crudType);
$concernData =& $this->crud[$crudType][$concern];
if ($concernData) {
$part = $this->standardizeConcernData($part);
$concernData = $this->standardizeConcernData($concernData);
$concernData = Arrays::merge($concernData, $part);
} else {
$concernData = $part;
}
return $concernData;
}