当前位置: 首页>>代码示例>>PHP>>正文


PHP arrayeval函数代码示例

本文整理汇总了PHP中arrayeval函数的典型用法代码示例。如果您正苦于以下问题:PHP arrayeval函数的具体用法?PHP arrayeval怎么用?PHP arrayeval使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了arrayeval函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: arrayeval

 function arrayeval($array, $level = 0)
 {
     if (!is_array($array)) {
         return "'" . $array . "'";
     }
     if (is_array($array) && function_exists('var_export')) {
         return var_export($array, true);
     }
     $space = '';
     for ($i = 0; $i <= $level; $i++) {
         $space .= "\t";
     }
     $evaluate = "Array\n{$space}(\n";
     $comma = $space;
     if (is_array($array)) {
         foreach ($array as $key => $val) {
             $key = is_string($key) ? '\'' . addcslashes($key, '\'\\') . '\'' : $key;
             $val = !is_array($val) && (!preg_match("/^\\-?[1-9]\\d*\$/", $val) || strlen($val) > 12) ? '\'' . addcslashes($val, '\'\\') . '\'' : $val;
             if (is_array($val)) {
                 $evaluate .= "{$comma}{$key} => " . arrayeval($val, $level + 1);
             } else {
                 $evaluate .= "{$comma}{$key} => {$val}";
             }
             $comma = ",\n{$space}";
         }
     }
     $evaluate .= "\n{$space})";
     return $evaluate;
 }
开发者ID:hqlulu,项目名称:startbbs,代码行数:29,代码来源:MY_Config.php

示例2: cache_write

function cache_write($name, $var, $values)
{
    $cachefile = S_ROOT . './data/data_' . $name . '.php';
    $cachetext = "<?php\r\n" . "if(!defined('IN_SYS')) exit('Access Denied');\r\n" . '$' . $var . '=' . arrayeval($values) . "\r\n?>";
    if (!swritefile($cachefile, $cachetext)) {
        exit("File: {$cachefile} write error.");
    }
}
开发者ID:hugolong,项目名称:weixiao,代码行数:8,代码来源:function_cache.php

示例3: pluginCache

	function pluginCache($cacheName,$varName,$data,$isarray){
		@require_once libfile('function/cache');
		if($isarray){
			$cacheArray .= "\$$varName=".arrayeval($data).";\n";
			writetocache($cacheName, $cacheArray);
		}else{
			$cacheArray .= "\$$varName=".$data.";\n";
			writetocache($cacheName, $cacheArray);
		}
	}
开发者ID:TedaLIEz,项目名称:Backup,代码行数:10,代码来源:hook.class.php

示例4: set_cache

 function set_cache($key, $value, $life)
 {
     global $_G;
     $data = array($key => array('data' => $value, 'life' => $life));
     require_once libfile('function/cache');
     $cache_file = $this->get_cache_file_path($key);
     dmkdir(dirname($cache_file));
     $cachedata = "\$data = " . arrayeval($data) . ";\n";
     if ($fp = @fopen($cache_file, 'wb')) {
         fwrite($fp, "<?php\n//Discuz! cache file, DO NOT modify me!" . "\n//Created: " . date("M j, Y, G:i") . "\n//Identify: " . md5($cache_file . $cachedata . $_G['config']['security']['authkey']) . "\n\nif(!defined('IN_DISCUZ')) {\n\texit('Access Denied');\n}\n\n{$cachedata}?>");
         fclose($fp);
     } else {
         exit('Can not write to cache files, please check directory ./data/ and ./data/ultraxcache/ .');
     }
     return true;
 }
开发者ID:pan289091315,项目名称:Discuz,代码行数:16,代码来源:cache_file.php

示例5: unset

 $modelsql = '';
 unset($resultmodels['mid']);
 $resultcolumns = array();
 $query = $_SGLOBAL['db']->query('SELECT * FROM ' . tname('modelcolumns') . ' WHERE mid = \'' . $_GET['mid'] . '\' ORDER BY displayorder, id');
 while ($value = $_SGLOBAL['db']->fetch_array($query)) {
     unset($value['id']);
     unset($value['mid']);
     if (!empty($value['upid']) && $value['formtype'] == 'linkage') {
         $value['upid'] = $cacheinfo['columnids'][$value['upid']];
     }
     $resultcolumns[] = $value;
 }
 $resultmodels['tpl'] = '';
 $tarr = array('info' => array('version' => S_VER, 'charset' => $_SCONFIG['charset']), 'models' => $resultmodels, 'columns' => $resultcolumns, 'categories' => $cacheinfo['categoryarr']);
 $modelsql = "/** SupeSite Dump\r\n" . " * Version: SupeSite " . S_VER . "\r\n" . " * Charset: " . $_SCONFIG['charset'] . "\r\n" . " * Time: {$time}\r\n" . " * From: {$_SCONFIG['sitename']} (" . S_URL . ")\r\n" . " * \r\n" . " * SupeSite: http://www.supesite.com\r\n" . " * Please visit our website for latest news about SupeSite\r\n" . " * --------------------------------------------------------*/\r\n\r\n\r\n";
 $modelsql .= '$cacheinfo = ' . arrayeval($tarr) . ';';
 if (!writefile($modelsqlfile, $modelsql, 'php')) {
     fclose($fp);
     deltree($datadir . '/' . $backupdir . '/');
     showmessage('file_write_error');
 } else {
     fclose($fp);
     $zipfilearr[] = $modelsqlfile;
 }
 $dberrorarr = array();
 $createtable = $tabledump = '';
 $_SGLOBAL['db']->query('SET SQL_QUOTE_SHOW_CREATE=0', 'SILENT');
 //ÎÞ±¨´íÖ´ÐйرÕÎҵĴ´½¨±íºÍÁÐʱ²»¼ÓÒýºÅ
 foreach ($modeldbarr as $tmpvalue) {
     $createtable = $_SGLOBAL['db']->query('SHOW CREATE TABLE ' . tname($resultmodels['modelname'] . $tmpvalue), 'SILENT');
     if (!$_SGLOBAL['db']->errno()) {
开发者ID:hongz1125,项目名称:devil,代码行数:31,代码来源:admin_models.php

示例6: arrayeval

function arrayeval($array, $level = 0)
{
    $space = '';
    $evaluate = "Array {$space}(";
    $comma = $space;
    foreach ($array as $key => $val) {
        $key = is_string($key) ? '\'' . addcslashes($key, '\'\\') . '\'' : $key;
        $val = !is_array($val) && (!preg_match("/^\\-?\\d+\$/", $val) || strlen($val) > 12) ? '\'' . addcslashes($val, '\'\\') . '\'' : $val;
        if (is_array($val)) {
            $evaluate .= "{$comma}{$key} => " . arrayeval($val, $level + 1);
        } else {
            $evaluate .= "{$comma}{$key} => {$val}";
        }
        $comma = ",{$space}";
    }
    $evaluate .= "{$space})";
    return $evaluate;
}
开发者ID:hongz1125,项目名称:devil,代码行数:18,代码来源:common.func.php

示例7: getcachevars

	$Id: admin.inc.php 21306 2009-11-26 00:56:50Z monkey $
*/

if(!defined('IN_DISCUZ') || !defined('IN_ADMINCP')) {
	exit('Access Denied');
}

$palang = $GLOBALS['scriptlang']['dps_postawards'];

@include_once DISCUZ_ROOT.'./forumdata/cache/cache_usergroups.php';

if(submitcheck('submit')){
	require_once DISCUZ_ROOT.'./include/cache.func.php';
	writetocache('postawards_setting', '', getcachevars(array('PACACHE' => array('userright' => $userright))));
	$cache = serialize($userright);
	$cachedata = "\$PACACHE['userright'] = ".arrayeval($userright).";\n\n";
	$db->query("REPLACE INTO {$tablepre}caches (cachename, type, dateline, data) VALUES ('postawards', '1', '$timestamp', '".addslashes($cachedata)."')");
}

@include_once DISCUZ_ROOT.'./forumdata/cache/cache_postawards_setting.php';

if(is_array($PACACHE)) {
	foreach($PACACHE['userright'] as $key => $item) {
		$postawards_checked[$key] = $item['postawards'] ? ' checked' : '';
		$systemcredit_checked[$key] = $item['systemcredit'] ? ' checked' : '';
		$ratemode_checked[$key] = $item['ratemode'] ? ' checked' : '';
		$ratelowlimit[$key] = $item['ratelowlimit'];
		$ratehighlimit[$key] = $item['ratehighlimit'];
		$ratealllimit[$key] = $item['ratealllimit'];
	}
}
开发者ID:BGCX262,项目名称:zyyhong-svn-to-git,代码行数:31,代码来源:admin.inc.php

示例8: update_table

function update_table()
{
    global $_G;
    $tablepre = $_G[_config][db][tablepre];
    $table = DB::fetch_all("SHOW TABLES");
    foreach ($table as $k => $v) {
        if (is_array($v)) {
            foreach ($v as $kk => $vv) {
                if (preg_match("/" . $tablepre . "/is", $vv)) {
                    $name = str_replace($tablepre, '', $vv);
                    $arr[$name] = array();
                    $rs = DB::fetch_all("SHOW FULL FIELDS FROM {$vv}");
                    foreach ($rs as $k1 => $v1) {
                        $f = array('type' => preg_replace("/\\(.*/", '', $v1['Type']));
                        if ($v1['Extra'] == 'auto_increment') {
                            $f[pre] = true;
                        }
                        $arr[$name][$v1['Field']] = $f;
                    }
                }
            }
        }
    }
    //写缓存,字段一定要写文件缓存.
    writetocache('table', arrayeval($arr));
    copy(ROOT_PATH . 'web/cache/cache_table.php', ROOT_PATH . 'inc/config/cache_table.php');
    $_G[table] = $arr;
    return $arr;
}
开发者ID:lqlstudio,项目名称:ttae_open,代码行数:29,代码来源:core.function.php

示例9: cacherobotlist

/**
 * 获取或生成采集地址
 */
function cacherobotlist($type, $url, $robotid, $sarray = array(), $varname = 'newurlarr')
{
    global $alang;
    $cachefile = S_ROOT . './data/robot/' . $robotid . '_' . md5($url) . '.php';
    if ($type == 'get') {
        if (file_exists($cachefile)) {
            include_once $cachefile;
            showprogress($alang['robot_robot_cache_read'] . ' (' . srealpath($cachefile) . ')', 1);
            //srealpath是格式化URL地址
            return ${$varname};
        } else {
            return false;
        }
    } else {
        $wtext = arrayeval($sarray);
        if (!@($fp = fopen($cachefile, 'w'))) {
            showprogress($alang['robot_robot_cache_write_failed'] . ' (' . srealpath($cachefile) . ')', 1);
            //缓存无法写入
        } else {
            $text = "<?php\n\n";
            $text .= '$' . $varname . '=';
            $text .= $wtext;
            $text .= "\n\n?>";
            flock($fp, 2);
            fwrite($fp, $text);
            fclose($fp);
            showprogress($alang['robot_robot_cache_write_success'] . ' (' . srealpath($cachefile) . ')', 1);
        }
    }
}
开发者ID:superman1982,项目名称:ng-cms,代码行数:33,代码来源:admin_robots.php

示例10: updateattrext

function updateattrext($force = true, $cachetime = '53200')
{
    global $_G, $_SGLOBAL;
    $cachefile = B_ROOT . './data/system/attr_ext.cache.php';
    if ($force == false) {
        $cachemtime = file_exists($cachefile) ? filemtime($cachefile) : 0;
        if ($_G['timestamp'] - $cachemtime < $cachetime) {
            @(include $cachefile);
            return false;
        }
    }
    $_SGLOBAL['brandlinks'] = $link = array();
    $query = DB::query('SELECT * FROM ' . tname('modelcolumns') . ' WHERE mid = 2 and available = 1 order by displayorder');
    while ($value = DB::fetch($query)) {
        if (!preg_match('/^ext_/', $value['fieldname'])) {
            continue;
        }
        $_SGLOBAL['attr_ext'][] = $value;
    }
    $cachetext = '$_SGLOBAL[\'attr_ext\']=' . arrayeval($_SGLOBAL['attr_ext']);
    writefile($cachefile, $cachetext, 'php');
    @(include $cachefile);
}
开发者ID:pan289091315,项目名称:Discuz,代码行数:23,代码来源:cache.func.php

示例11: getcachevars

function getcachevars($data, $type = 'VAR')
{
    $evaluate = '';
    !is_array($data) && ($data = array($data));
    foreach ($data as $key => $val) {
        if (!preg_match("/^[a-zA-Z_-�][a-zA-Z0-9_-�]*\$/", $key)) {
            continue;
        }
        if (is_array($val)) {
            $evaluate .= "\${$key} = " . arrayeval($val) . ";\n";
        } else {
            $val = addcslashes($val, '\'\\');
            $evaluate .= $type == 'VAR' ? "\${$key} = '{$val}';\n" : "define('" . strtoupper($key) . "', '{$val}');\n";
        }
    }
    return $evaluate;
}
开发者ID:Zniel,项目名称:fl_crtlpanel_self_dev,代码行数:17,代码来源:pm_core_functions.php

示例12: save_config

 private function save_config($focus = false)
 {
     if (TAE) {
         return true;
     }
     $file = ROOT_PATH . 'install/init_config.txt';
     if (is_file($file) && !$focus) {
         return false;
     }
     $db_file = ROOT_PATH . 'inc/config/db.config.php';
     $authkey = random(10);
     $rs = arrayeval($this->_config['db']);
     $text = "\r\n";
     $text .= "\$_config['authkey'] = '{$authkey}';\r\n";
     $text .= "\$_config['db']=" . $rs . ";\r\n";
     $text .= "\r\n?>";
     //检查原db.config.php文件是否存在数据库信息
     $db_content = file_get_contents($db_file);
     //如存在,则将原db.config.php中的内容正则提取出来,并替换成新的追加到db.config.php
     if (strpos($db_content, 'authkey') !== false) {
         $new_content = preg_replace("/\\\$_config\\['authkey'\\](.*)\$/is", $text, $db_content);
     } else {
         $new_content = preg_replace("/\\?>/is", $text, $db_content);
     }
     if (!$new_content) {
         json('写入配置文件失败,请检查inc/config/目录是否有写入权限');
     }
     $len = file_put_contents($db_file, $new_content);
     if ($len <= 0) {
         json('写入数据库配置文件失败,请检查inc/config/目录是否有写入权限');
     }
     file_put_contents($file, 'init ok');
     return true;
 }
开发者ID:lqlstudio,项目名称:ttae_open,代码行数:34,代码来源:install.php

示例13: model_cache

function model_cache()
{
    global $_SGLOBAL;
    $_SGLOBAL['updatemodel'] = array('model' => array(), 'category' => array(), 'comment' => array(), 'folder' => array());
    $query = $_SGLOBAL['db']->query("SELECT * FROM " . tname('models') . " m, " . tname('channels') . " c WHERE m.modelname = c.nameid");
    while ($value = $_SGLOBAL['db']->fetch_array($query)) {
        $_SGLOBAL['updatemodel']['model'][$value['mid']] = $value;
        $_SGLOBAL['updatemodel']['category'][$value['mid']] = $value['mid'];
        $_SGLOBAL['updatemodel']['comment'][$value['mid']] = $value['mid'];
        $_SGLOBAL['updatemodel']['folder'][$value['mid']] = $value['mid'];
        $_SGLOBAL['updatemodel']['hot'][$value['mid']] = $value['mid'];
        $_SGLOBAL['updatemodel']['cache'][$value['mid']] = $value['mid'];
    }
    $cachefile = S_ROOT . './data/system/update_model.cache.php';
    $text = '$_SGLOBAL[\'updatemodel\']=' . arrayeval($_SGLOBAL['updatemodel']) . ";";
    writefile($cachefile, $text, 'php');
}
开发者ID:nickflyer,项目名称:osscms,代码行数:17,代码来源:update.php

示例14: brian_cat_cache

function brian_cat_cache()
{
    require_once libfile('function/cache');
    $cat_array = array();
    $cat_array = brian_fetch_all('info_cat', ' ORDER BY cat_sort ASC', array('sort' => 'cat_id'));
    foreach ($cat_array as $k => $v) {
        if (!empty($v['cat_pid'])) {
            $ddd_time = time();
            $cat_array[$k]['sum'] = DB::result_first("SELECT count(post_id) FROM " . DB::table("info_post") . " WHERE subcat_id = '{$v['cat_id']}' and `post_begin_time` > 0 and `post_begin_time` < '{$ddd_time}' and `post_end_time` > '{$ddd_time}'  ");
        }
    }
    $cat_array_field .= "\$cat_array = " . arrayeval($cat_array) . ";\n";
    writetocache('info_cat_array', $cat_array_field);
}
开发者ID:edmundwong,项目名称:V604,代码行数:14,代码来源:function.class.php

示例15: mktime

             $time = mktime(0, 0, 0, $tomonth, $todate, $toyear) - 604800;
         } elseif ($homeshow['Five_Date'] == 3) {
             $time = mktime(0, 0, 0, $tomonth, 1, $toyear);
         } elseif ($homeshow['Five_Date'] == 4) {
             $time = mktime(0, 0, 0, 1, 1, $toyear);
         } else {
             $time = 0;
         }
         $query = $db->query("select count(pid) as num, authorid, author from {$tablepre}posts where dateline >= {$time} group by authorid order by num desc limit 0, 15");
         while ($result = $db->fetch_array($query)) {
             $result['avatar'] = discuz_uc_avatar($result['authorid'], small);
             $result['autitl'] = $result['author'];
             $result['author'] = cutstr($result['author'], $homeshow['AuNums']);
             $poststar[] = $result;
         }
         $cacheArray .= "\$poststar = " . arrayeval($poststar) . ";\n";
     }
     unset($query, $poststar);
     writetocache('homeshow', '', $cacheArray);
     unset($cacheArray);
 }
 require_once $cacheFile;
 if (@$pic) {
     PHP_VERSION > 4.3 ? shuffle($pic) : '';
     $i = 0;
     foreach ($pic as $key => $val) {
         if (is_readable($val['picpics']) || substr($val['picpics'], 0, 4) == 'http') {
             $picpics .= $comma . $val['picpics'];
             $piclinks .= $comma . $val['piclinks'];
             $pictexts .= $comma . $val['pictexts'];
             $comma = '|';
开发者ID:xiaoxiaoleo,项目名称:ngintek,代码行数:31,代码来源:homeshow.php


注:本文中的arrayeval函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。