本文整理汇总了PHP中arrayToString函数的典型用法代码示例。如果您正苦于以下问题:PHP arrayToString函数的具体用法?PHP arrayToString怎么用?PHP arrayToString使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了arrayToString函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: formatValue
/**
* Formata o valor
* @param mixed $value
* @param string $type
* @param boolean $formatar
* @return mixed
*/
function formatValue($value, $type, $formatar)
{
switch (strtolower($type)) {
case 'data':
case 'dt':
case 'date':
$value = Date::data((string) $value);
return $formatar ? Date::formatData($value) : $value;
break;
case 'timestamp':
case 'datatime':
$value = Date::timestamp((string) $value);
return $formatar ? Date::formatDataTime($value) : $value;
break;
case 'real':
return $formatar ? Number::real($value) : Number::float($value, 2);
case 'hide':
return $formatar ? null : $value;
break;
case 'array':
return $formatar ? stringToArray($value) : arrayToString($value);
break;
default:
return $value;
}
}
示例2: getSize
/**
* Method:search
*/
public function getSize($doc, $page, $mode)
{
$output = array();
try {
if ($this->configManager->getConfig('splitmode') == 'true') {
$swfdoc = $doc . "_" . $page . ".swf";
} else {
$swfdoc = $doc . ".swf";
}
$swfFilePath = $this->configManager->getConfig('path.swf') . $swfdoc;
// check for directory traversal & access to non pdf files and absurdely long params
if (!validSwfParams($swfFilePath, $swfdoc, $page)) {
return;
}
if ($mode == 'width') {
$command = $this->configManager->getConfig('cmd.query.swfwidth');
}
if ($mode == 'height') {
$command = $this->configManager->getConfig('cmd.query.swfheight');
}
$command = str_replace("{path.swf}", $this->configManager->getConfig('path.swf'), $command);
$command = str_replace("{swffile}", $swfFilePath, $command);
$return_var = 0;
exec($command, $output, $return_var);
if ($return_var == 0) {
return strip_non_numerics(arrayToString($output));
} else {
return "[Error Extracting]";
}
} catch (Exception $ex) {
return $ex;
}
}
示例3: createCache
/**
* 生成缓存文件
*/
public function createCache()
{
$path_file = UPLOAD_PATH . '/cache/';
$file_name = $path_file . date('Ymd', time()) . '.txt';
if (!file_exists($file_name)) {
foreach ($data2 as $v) {
$pinyin = $this->pinyin($v['name']);
$array['arr'][] = [$pinyin => $v['name']];
}
$data3 = $this->m['columns']->getAllByField('module', 'ksys', 'id');
$data4 = $this->m['article']->getAll(arrayToString($data3), 'title');
foreach ($data4 as $v) {
$pinyin = $this->pinyin($v['title']);
$array['arr'][] = [$pinyin => $v['title']];
}
if (!file_exists($path_file)) {
mkdirs($path_file);
}
$open = fopen($file_name, "a");
fwrite($open, serialize($array));
fclose($open);
} else {
return;
}
}
示例4: groupEdit
public function groupEdit()
{
if (IS_POST) {
$id = I("id");
$rules = I("list");
$title = I("title");
if (!id || !is_array($rules) || empty($rules) || !$title) {
$this->error("请填写相关数据");
}
$arr = arrayToString($rules);
$data = array("title" => $title, "rules" => $arr);
$save = M("auth_group")->where(array("id" => $id))->save($data);
if (!$save) {
$this->error("保存失败");
}
$this->success("操作成功");
} else {
$id = I("id");
$info = M("auth_group")->where(array("id" => $id))->find();
$rules = explode(",", $info['rules']);
$this->rules = $rules;
$this->info = $info;
$arr = getRules($column, $rules);
//dump($column);
$this->arr = $arr;
$this->display();
}
}
示例5: runclass
function runclass($function, $params, $content, $arrayin = false)
{
switch ($function) {
case "vdir":
# {vdir|path} - will remove paths if using domainTranslation or any different context.
# path should be the FULL path FROM ROOT (ignoring CONS_INSTALL_ROOT)
# WILL ADD CONS_INSTALL_ROOT if necessary
$vdir = "";
if ($this->parent->forceVDIRTL && count($this->parent->languageTL) > 1) {
foreach ($this->parent->languageTL as $f => $l) {
if ($l == $_SESSION[CONS_SESSION_LANG]) {
$vdir = $f . "/";
break;
}
}
}
if (!isset($params[0]) || $params[0] == '' || $params[0] == '/') {
return CONS_INSTALL_ROOT . $vdir;
}
if ($params[0] != '' && substr($params[0], 0, strlen(CONS_INSTALL_ROOT)) != CONS_INSTALL_ROOT) {
$params[0] = CONS_INSTALL_ROOT . $vdir . $params[0];
} else {
if ($vdir != '') {
$params[0] = CONS_INSTALL_ROOT . $vdir . substr($params[0], strlen(CONS_INSTALL_ROOT));
}
}
$params[0] = preg_replace("@/{1,}@", "/", $params[0]);
return $params[0];
break;
case "query_strings":
# {query_strings} or {query_strings|comma separated list of query items to exclude}
if (!isset($params[0]) || $params[0] == '') {
$itemsToExclude = array();
} else {
$itemsToExclude = explode(",", $params[0]);
}
if (!in_array("haveinfo", $itemsToExclude)) {
$itemsToExclude[] = "haveinfo";
}
if (!in_array("debugmode", $itemsToExclude)) {
$itemsToExclude[] = "debugmode";
}
if (!in_array("nocache", $itemsToExclude)) {
$itemsToExclude[] = "nocache";
}
if (!in_array("nosession", $itemsToExclude)) {
$itemsToExclude[] = "nosession";
}
$qs = arrayToString(false, $itemsToExclude);
return "?" . $qs;
break;
default:
if (isset($this->parent->tClass[$function])) {
return $this->parent->loadedPlugins[$this->parent->tClass[$function]]->tclass($function, $params, $content, $arrayin);
}
break;
}
return $content;
}
示例6: convert
/**
* Method:convert
*/
public function convert($doc, $page, $subfolder)
{
$output = array();
$pdfFilePath = $this->configManager->getConfig('path.pdf') . $subfolder . $doc;
$swfFilePath = $this->configManager->getConfig('path.swf') . $subfolder . $doc . $page . ".swf";
if ($this->configManager->getConfig('splitmode') == 'true') {
$command = $this->configManager->getConfig('cmd.conversion.splitpages');
} else {
$command = $this->configManager->getConfig('cmd.conversion.singledoc');
}
$command = str_replace("{path.pdf}", $this->configManager->getConfig('path.pdf') . $subfolder, $command);
$command = str_replace("{path.swf}", $this->configManager->getConfig('path.swf') . $subfolder, $command);
$command = str_replace("{pdffile}", $doc, $command);
try {
if (!$this->isNotConverted($pdfFilePath, $swfFilePath)) {
array_push($output, utf8_encode("[Converted]"));
return arrayToString($output);
}
} catch (Exception $ex) {
array_push($output, "Error," . utf8_encode($ex->getMessage()));
return arrayToString($output);
}
$return_var = 0;
if ($this->configManager->getConfig('splitmode') == 'true') {
$pagecmd = str_replace("%", $page, $command);
$pagecmd = $pagecmd . " -p " . $page;
exec($pagecmd, $output, $return_var);
$hash = getStringHashCode($command);
if (!isset($_SESSION['CONVERSION_' . $hash])) {
exec(getForkCommandStart() . $command . getForkCommandEnd());
$_SESSION['CONVERSION_' . $hash] = true;
}
} else {
exec($command, $output, $return_var);
}
if ($return_var == 0 || strstr(strtolower($return_var), "notice")) {
$s = "[Converted]";
} else {
$errmsgs = arrayToString($output);
if (strrpos($errmsgs, "too complex") > 0 && !$this->configManager->getConfig('splitmode') == 'true') {
$s = " This document is too complex to render in simple mode. Please use split mode when rendering documents like these.";
} else {
if (strpos($errmsgs, "FATAL") > 0) {
if (strpos($errmsgs, "\n", strpos($errmsgs, "FATAL")) > 0) {
$s = " " . substr($errmsgs, strpos($errmsgs, "FATAL") + 8, strpos($errmsgs, "\n", strpos($errmsgs, "FATAL")) - strpos($errmsgs, "FATAL"));
} else {
$s = " " . substr($errmsgs, strpos($errmsgs, "FATAL") + 8, strpos($errmsgs, "\n", strpos($errmsgs, "FATAL")) - strpos($errmsgs, "FATAL"));
}
$s = str_replace("Internal error", "PDF conversion error", $s);
} else {
$s = " Error converting document, make sure the conversion tool is installed and that correct user permissions are applied to the SWF Path directory" . $this->configManager->getDocUrl();
}
}
}
return $s;
}
示例7: cacheFile
function cacheFile()
{
# Returns which cache file should be used for this page
$keyOne = $this->parent->original_context_str . $this->parent->original_action . $this->cacheseed . $this->cacheuid();
$keyTwo = arrayToString($_GET, array("__utma", "__utmb", "__utmc", "__utmz", "__atuvc", "PHPSESSID"), true);
# Remove Google big-brother shit
$keyOne = md5($keyOne);
// shorten and standardize a little
$keyTwo = md5($keyTwo);
return $this->cachepath . $keyOne . $keyTwo . ".cache";
}
示例8: write
function write()
{
$write = '$' . $this->getName() . ' = new Template(';
$write .= '\'' . $this->getName() . '\', ';
$write .= array_search($this->getType(), returnConstants("TEMPLATE_")) . ', ';
$write .= '\'' . addcslashes($this->getLocation(), '\'') . '\', ';
$write .= arrayToString($this->content);
// $write .= arrayToString($this->getContent());
// $write .= '\'' . addcslashes($this->getContent(), '\'') . '\'';
$write .= ');';
return $write;
}
示例9: getJoin
function getJoin($table1, $table2, $joinOn, $t1_constraints, $t2_constraints)
{
$t1_q = getTableQuote($table1);
$t2_q = getTableQuote($table2);
$jo = getJoinOn($table1, $table2, $joinOn);
$tables = [];
$tables[$table1] = $t1_constraints;
$tables[$table2] = $t2_constraints;
$con = getConstraintsWithTables($tables);
$t2_columns = arrayToString(getColumnNamesWithTable($table2));
$query = "SELECT " . $t1_q . ".*, " . $t2_columns . " FROM " . $t1_q . " INNER JOIN " . $t2_q . " ON " . $jo . " " . $con . ";";
return $query;
}
示例10: getJoin
function getJoin($table1, $table2, $joinOn, $t1_constraints, $t2_constraints)
{
$t1_q = getTableQuote($table1);
$t2_q = getTableQuote($table2);
$jo = getJoinOn($table1, $table2, $joinOn);
$tables = [];
$tables[$table1] = $t1_constraints;
$tables[$table2] = $t2_constraints;
$con = getConstraintsWithTables($tables);
$t2_columns = arrayToString(getColumnNamesWithTable($table2));
$query = "SELECT {$t1_q}.*, {$t2_columns} FROM {$t1_q} INNER JOIN {$t2_q} ON {$jo} {$con};";
return $query;
}
示例11: arrayToString
function arrayToString($arr)
{
$s = "Array(";
$parts = array();
foreach ($arr as $k => $v) {
if (is_array($v)) {
$v = arrayToString($v);
}
$parts[] = sprintf("%s => %s", $k, $v);
}
$s .= implode(", ", $parts);
$s .= ")";
return $s;
}
示例12: inStrRev
function inStrRev($content, $search)
{
if (is_array($content)) {
$content = arrayToString($content, "");
}
if ($search != "") {
if (strstr($content, $search) != '') {
return mb_strrpos($content, $search, 0, "gb2312") + 1;
} else {
return 0;
}
} else {
return 0;
}
}
示例13: index
/**
* 文章首页
* @return array
*/
public function index()
{
$classid = $this->get('classid') ? $this->m['columns']->columnsIsdonw($this->get('classid')) : 0;
$levelid = arrayToString($this->m['columns']->getLevelId($this->get('classid')));
if ($this->get('classid')) {
if ($levelid) {
$num_id = $this->get('classid') . ',' . $levelid;
} else {
$num_id = $this->get('classid');
}
} else {
$num_id = $levelid;
}
$data['columns'] = $this->m['columns']->getAll($classid);
if ($num_id) {
if ($this->judge_power('article', 'aprrove') && $_SESSION['power_id']) {
$data['article'] = $this->m['article']->ShgetPage($num_id, $this->get('field'), $this->get('title'), 20);
} else {
$data['article'] = $this->m['article']->getPage($num_id, $this->get('field'), $this->get('title'), 20);
}
}
foreach ($data['article']['list'] as $k => $v) {
$template = $this->m['columns']->getOne($v['columnsid'], 'template');
if (!$v['html']) {
$url = $template . $v['id'] . '.shtml';
} else {
$url = $v['html'];
}
$v['url'] = $url;
$data['article']['list'][$k] = $v;
}
$array['article_list']['columns'] = $data['columns'];
$array['article_list']['article'] = $data['article'];
$array['fy'] = $data['article']['fy'];
foreach ($array['article_list']['columns'] as $k => $v) {
if ($this->m['columns']->getAll($v['id'])) {
$array['article_list']['columns'][$k]['pid'] = 1;
} else {
$array['article_list']['columns'][$k]['pid'] = 0;
}
}
$this->display('Article/index.html', $array);
}
示例14: get_header
public function get_header($header = array())
{
if (isset($header['css_page_style'])) {
$this->load->helper('array');
//把css样式组成字符串
$data['css_page_style'] = arrayToString($header['css_page_style']);
} else {
$data['css_page_style'] = '';
}
if (isset($header['meta'])) {
$data['meta'] = $header['meta'];
} else {
$data['meta'] = '';
}
if (isset($header['title'])) {
$data['title'] = $header['title'];
} else {
$data['title'] = '';
}
if (isset($header['style'])) {
$data['style'] = $header['style'];
} else {
$data['style'] = '';
}
$this->load->model('setting/base_setting');
$data['website_title'] = $this->base_setting->get_setting('website_title');
if (isset($header['meta_key'])) {
$data['mate_key'] = $header['meta_key'];
} else {
$data['mate_key'] = $this->base_setting->get_setting('mate_key');
}
if (isset($header['meta_description'])) {
$data['mate_description'] = $header['meta_description'];
} else {
$data['mate_description'] = $this->base_setting->get_setting('mate_description');
}
$data['mate_author'] = $this->base_setting->get_setting('mate_author');
$this->report_access();
//$this->output->enable_profiler(TRUE);
return $this->load->view('common/header', $data);
}
示例15: findText
/**
* Method:extractText
*/
public function findText($doc, $page, $searchterm, $numPages = -1)
{
$output = array();
if (strlen($searchterm) == 0) {
return "[{\"page\":-1, \"position\":-1}]";
}
try {
$swf_file = $this->configManager->getConfig('path.swf') . $doc . "_" . $page . ".swf";
if (!file_exists($swf_file)) {
return "[{\"page\":-1, \"position\":-1}]";
}
// check for directory traversal & access to non pdf files and absurdely long params
$pdfFilePath = $this->configManager->getConfig('path.pdf') . $doc;
if ($numPages == -1) {
$pagecount = count(glob($this->configManager->getConfig('path.swf') . $doc . "*"));
} else {
$pagecount = $numPages;
}
if (!validPdfParams($pdfFilePath, $doc, $page)) {
return;
}
$command = $this->configManager->getConfig('cmd.searching.extracttext');
$command = str_replace("{swffile}", $this->configManager->getConfig('path.swf') . $doc . "_" . $page . ".swf", $command);
$return_var = 0;
exec($command, $output, $return_var);
$pos = strpos(strtolower(arrayToString($output)), strtolower($searchterm));
if ($return_var == 0 && $pos > 0) {
return "[{\"page\":" . $page . ", \"position\":" . $pos . "}]";
} else {
if ($page < $pagecount) {
$page++;
return $this->findText($doc, $page, $searchterm, $pagecount);
} else {
return "[{\"page\":-1, \"position\":-1}]";
}
}
} catch (Exception $ex) {
return $ex;
}
}