1 Star 0 Fork 16

哆来咪/phpfun

forked from ownfire/phpfun 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
init.php 1.85 KB
一键复制 编辑 原始数据 按行查看 历史
wuxiao 提交于 2015-08-28 18:44 +08:00 . web->js() + less.js
<?php
$GLOBALS['requires'] = array();
if (!function_exists('req_once')){
function req_once($filename){
global $requires;
$filename = (string)$filename;
if (empty($filename))
return false;
if (!$filename = realpath($filename))
return false;
if (isset($requires[$filename]))
return true;
if (!is_file($filename))
return false;
$requires[$filename] = true;
return require_once $filename;
}
}
$GLOBALS['errors'] = array();
if (!function_exists('error')) {
function error($msg = null) {
global $errors;
if ($msg === null)
return $errors;
$msg = (string) $msg;
if (!empty($msg))
array_push($errors, array('time' => time(), 'text' => $msg));
return false;
}
}
if (!function_exists('got')){
function got($a,$k,$default = NULL){
if (is_array($a) && isset($a[$k])) return $a[$k];
if (is_object($a) && isset($a->$k)) return $a->$k;
return $default;
}
}
if (!function_exists('eq')){//获取数组中的第$index个元素
function eq(array $haystack,$index){
if (!is_int($index) || empty($haystack) || (count($haystack) < $index))
return false;
reset($haystack);
$i = 0;
while ($i<$index){
$i++;
next($haystack);
}
return current($haystack);
}
}
/*
* 格式化输出
*/
if (!function_exists('dump')) {
function dump() {
$o = func_get_args();
$is_cmd = ((PHP_SAPI === 'cli') or isset($_SERVER['argv']));
if ($is_cmd) {
foreach ($o as $o){
echo var_export($o, true), "\n";
}
} else {
foreach ($o as $o){
echo '<pre>', var_export($o, true), "</pre>\n";
}
}
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/dlm2015/phpfun.git
git@gitee.com:dlm2015/phpfun.git
dlm2015
phpfun
phpfun
master

搜索帮助