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


PHP sreadfile函数代码示例

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


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

示例1: readtemplate

function readtemplate($name)
{
    global $_SGLOBAL;
    $tplfile = S_ROOT . './' . $name . '.htm';
    $_SGLOBAL['sub_tpls'][] = $name;
    $content = sreadfile($tplfile);
    return $content;
}
开发者ID:nymbian,项目名称:codelib,代码行数:8,代码来源:function_template.php

示例2: getcssname

function getcssname($dirname) {
	$css = sreadfile(S_ROOT.'./theme/'.$dirname.'/style.css');
	if($css) {
		preg_match("/\[name\](.+?)\[\/name\]/i", $css, $mathes);
		if(!empty($mathes[1])) $name = shtmlspecialchars($mathes[1]);
	} else {
		$name = 'No name';
	}
	return $name;
}
开发者ID:BGCX262,项目名称:zyyhong-svn-to-git,代码行数:10,代码来源:cp_theme.php

示例3: readTemplate

 function readTemplate($file)
 {
     $common_dir = ROOT_PATH . '/public/common/';
     $file = $common_dir . $file . '.html';
     if (file_exists($file)) {
         return sreadfile($file);
     } else {
         die("template " . $file . ' not exists !');
     }
 }
开发者ID:jjvein,项目名称:my_php_framework,代码行数:10,代码来源:base.inc.php

示例4: trans_file

 public static function trans_file($tmpdir)
 {
     global $_G;
     //处理非 GBK 编码
     if ($_G['product']['charset'] != 'gbk') {
         //获取文件清单
         $list = rglob($tmpdir . '{*.php,*.htm,*.sql}', GLOB_BRACE);
         /////////////////////
         //批量转换编码
         foreach ($list as $file) {
             $text = iconv('GBK', $_G['product']['charset'] . '//IGNORE', sreadfile($file));
             create_file($file, $text);
         }
         /////////////////////
         //标识新编码
         $file = $tmpdir . 'config/version.php';
         if (file_exists($file)) {
             $text = sreadfile($file);
             $text = preg_replace("/\\['product'\\]\\['charset'\\]\t= '.*?';/i", "['product']['charset']\t= '" . $_G['product']['charset'] . "';", $text);
             create_file($file, $text);
         }
     }
 }
开发者ID:a195474368,项目名称:ejw,代码行数:23,代码来源:cloud.php

示例5: rewrite

 public static function rewrite($appid)
 {
     global $_G;
     global $_CACHE;
     //当前目录
     $base = VI_ROOT . 'module/' . $appid;
     //XML 地址
     $data = $base . '/rewrite.xml';
     //存储目录
     $save = $base . '/content/.htaccess';
     //找到规则文件
     if (file_exists($data)) {
         //转成数组
         $docm = xml_array(sreadfile($data));
         //验证是否有效
         if (is_array($docm)) {
             //获取规则模板
             $text = $docm['config'][$_G['setting']['global']['rewrite']['platform']];
             //修正基准目录
             if ($_CACHE['system']['module'][$appid]['domain']) {
                 $text = str_replace('{BASE}', '/', $text);
             } else {
                 $text = str_replace('{BASE}', VI_BASE . 'module/' . $appid . '/content/', $text);
             }
             //转编码(Linux 主机必需为 ANSI 格式)
             $text = iconv('UTF-8', 'GBK', trim($text));
             return create_file($save, $text);
         }
     }
     /*
     // Load the XML source
     $xml = new DOMDocument;
     $xml->load( $data );		
     $doc = $xml->getElementsByTagName('key');		
     for ($i=0;$i<$doc->length;$i++){			
     	$ele = $doc->item($i);			
     	if( $ele -> getAttribute("name") == $mode ){
     		$text = trim( $ele -> nodeValue );
     		
     		//如果有绑定域名
     		if( $domain ){
     			$text = str_replace( '{BASE}', '/', $text );
     		}else{					
     			$text = str_replace( '{BASE}', VI_BASE.'module/'.$this -> appid.'/content/', $text );
     		}
     		
     		//转编码(Linux 主机必需为 ANSI 格式)
     		$text = iconv('UTF-8','GBK',$text);
     		
     		return create_file( $save , $text );
     		break;
     	}
     	
     }
     */
 }
开发者ID:a195474368,项目名称:ejw,代码行数:56,代码来源:module.php

示例6: readtemplate

function readtemplate($name)
{
    global $_SGLOBAL, $_SCONFIG;
    $tpl = strexists($name, '/') ? $name : "template/{$_SCONFIG['template']}/{$name}";
    $tplfile = S_ROOT . './' . $tpl . '.htm';
    $_SGLOBAL['sub_tpls'][] = $tpl;
    if (!file_exists($tplfile)) {
        $tplfile = str_replace('/' . $_SCONFIG['template'] . '/', '/default/', $tplfile);
    }
    $content = sreadfile($tplfile);
    return $content;
}
开发者ID:xiaoxiaoleo,项目名称:ngintek,代码行数:12,代码来源:function_template.php

示例7: ftell

             $o = ftell($fp) - $n;
             $lines[] = $cursor . '-' . $o . '-' . $n;
             //Record information: the line number - the starting position - length
             if ($offset >= $start && $offset < $start + $perpage) {
                 $list[] = $loginfo;
             }
             $offset++;
         }
         $cursor++;
     }
     fclose($fp);
     $count = count($lines);
     swritefile($tmpfile, implode(';', $lines));
 }
 if ($fromcache) {
     $data = explode(';', sreadfile($tmpfile));
     $count = count($data);
     $lines = array_slice($data, $start, $perpage);
     if ($lines) {
         $fp = fopen(S_ROOT . './data/log/' . $_GET['file'], 'r');
         foreach ($lines as $line) {
             list($l, $o, $n) = explode('-', $line);
             fseek($fp, $o);
             $line = $n ? fread($fp, $n) : '';
             $loginfo = parselog($line);
             $loginfo['line'] = $l;
             $uids[] = $loginfo['uid'];
             $list[] = $loginfo;
         }
         fclose($fp);
     }
开发者ID:v998,项目名称:discuzx-en,代码行数:31,代码来源:admincp_log.php

示例8: closedir

        closedir($dh);
    }
} elseif ($_GET['op'] == 'edit') {
    $filename = checkfilename($_GET['filename']);
    $filefullname = $tpldir . $filename;
    $fp = fopen($filefullname, 'rb');
    $content = trim(shtmlspecialchars(fread($fp, filesize($filefullname))));
    fclose($fp);
} elseif ($_GET['op'] == 'repair') {
    $filename = checkfilename($_GET['filename']);
    $filefullname = $tpldir . $filename;
    //复制当前的文件
    $d_file = $filefullname . '.bak';
    if (file_exists($d_file)) {
        if (!@copy($d_file, $filefullname)) {
            swritefile($filefullname, sreadfile($d_file));
            @unlink($d_file);
        } else {
            @unlink($d_file);
        }
    } else {
        cpmessage('designated_template_files_can_not_be_restored');
    }
    cpmessage('do_success', $turl);
}
function checkfilename($filename)
{
    global $tpldir;
    $isedit = false;
    if (!empty($filename)) {
        $filename = str_replace(array('..', '/', '\\'), array('', '', ''), $filename);
开发者ID:NaturalWill,项目名称:UCQA,代码行数:31,代码来源:admincp_template.php

示例9: saveremotefile

function saveremotefile($url, $thumbarr = array(100, 100), $mkthumb = 1, $maxsize = 0)
{
    global $_SCONFIG, $_SGLOBAL;
    $patharr = $blank = array('file' => '', 'thumb' => '', 'name' => '', 'type' => '', 'size' => 0);
    $ext = fileext($url);
    $patharr['type'] = $ext;
    if (in_array($ext, array('jpg', 'jpeg', 'gif', 'png'))) {
        $isimage = 1;
    } else {
        $isimage = 0;
        $ext = 'attach';
    }
    //debug 文件名
    if (empty($_SGLOBAL['_num'])) {
        $_SGLOBAL['_num'] = 0;
    }
    $_SGLOBAL['_num'] = intval($_SGLOBAL['_num']);
    $_SGLOBAL['_num']++;
    $filemain = $_SGLOBAL['supe_uid'] . '_' . sgmdate($_SGLOBAL['timestamp'], 'YmdHis') . $_SGLOBAL['_num'] . random(4);
    $patharr['name'] = $filemain . '.' . $ext;
    //debug 得到存储目录
    $dirpath = getattachdir();
    if (!empty($dirpath)) {
        $dirpath .= '/';
    }
    $patharr['file'] = $dirpath . $filemain . '.' . $ext;
    //debug 上传
    $content = sreadfile($url, 'rb', 1, $maxsize);
    if (empty($content)) {
        return $blank;
    }
    writefile(A_DIR . '/' . $patharr['file'], $content, 'text', 'wb', 0);
    if (!file_exists(A_DIR . '/' . $patharr['file'])) {
        return $blank;
    }
    $imageinfo = @getimagesize(A_DIR . '/' . $patharr['file']);
    list($width, $height, $type) = !empty($imageinfo) ? $imageinfo : array('', '', '');
    if (!in_array($type, array(1, 2, 3, 6, 13))) {
        @unlink(A_DIR . '/' . $patharr['file']);
        return $blank;
    }
    $patharr['size'] = filesize(A_DIR . '/' . $patharr['file']);
    //debug 缩略图水印
    if ($isimage) {
        if ($mkthumb && $ext != 'gif') {
            //debug 缩略图
            $patharr['thumb'] = makethumb($patharr['file'], $thumbarr);
            //debug 加水印
            if (!empty($patharr['thumb'])) {
                makewatermark($patharr['file']);
            }
        }
        if (empty($patharr['thumb'])) {
            $patharr['thumb'] = $patharr['file'];
        }
    }
    return $patharr;
}
开发者ID:hongz1125,项目名称:devil,代码行数:58,代码来源:upload.func.php

示例10: serialize

		$eventlist[] = $value;
	}
	if($_SGLOBAL['network']['event']['cache']) {
		swritefile($cachefile, serialize($eventlist));
	}
}
foreach($eventlist as $key => $value) {
	realname_set($value['uid'], $value['username']);
	$eventlist[$key] = $value;
}


//投票
$cachefile = S_ROOT.'./data/cache_network_poll.txt';
if(check_network_cache('poll')) {
	$polllist = unserialize(sreadfile($cachefile));
} else {
	$sqlarr = mk_network_sql('poll',
		array('pid', 'uid'),
		array('hot','voternum','replynum'),
		array('dateline'),
		array('dateline','voternum','replynum','hot')
	);
	extract($sqlarr);

	//显示数量
	$shownum = 9;
	
	$polllist = array();
	$query = $_SGLOBAL['db']->query("SELECT main.*
		FROM ".tname('poll')." main
开发者ID:NaturalWill,项目名称:UCQA,代码行数:31,代码来源:network.php

示例11: showmessage

    //已登录,直接跳转个人首页
    showmessage('enter_the_space', 'space.php?do=home', 0);
}
if (empty($_SCONFIG['networkpublic'])) {
    $cachefile = S_ROOT . './data/cache_index.txt';
    $cachetime = @filemtime($cachefile);
    $spacelist = array();
    if ($_SGLOBAL['timestamp'] - $cachetime > 900) {
        //20位热门用户
        $query = $_SGLOBAL['db']->query("SELECT s.*, sf.resideprovince, sf.residecity\r\n\t\t\tFROM " . tname('space') . " s\r\n\t\t\tLEFT JOIN " . tname('spacefield') . " sf ON sf.uid=s.uid\r\n\t\t\tORDER BY s.friendnum DESC LIMIT 0,20");
        while ($value = $_SGLOBAL['db']->fetch_array($query)) {
            $spacelist[] = $value;
        }
        swritefile($cachefile, serialize($spacelist));
    } else {
        $spacelist = unserialize(sreadfile($cachefile));
    }
    //应用
    $myappcount = 0;
    $myapplist = array();
    if ($_SCONFIG['my_status']) {
        $myappcount = $_SGLOBAL['db']->result($_SGLOBAL['db']->query("SELECT COUNT(*) FROM " . tname('myapp') . " WHERE flag>='0'"), 0);
        if ($myappcount) {
            $query = $_SGLOBAL['db']->query("SELECT appid,appname FROM " . tname('myapp') . " WHERE flag>=0 ORDER BY flag DESC, displayorder LIMIT 0,7");
            while ($value = $_SGLOBAL['db']->fetch_array($query)) {
                $myapplist[] = $value;
            }
        }
    }
    //实名
    foreach ($spacelist as $key => $value) {
开发者ID:AlexChien,项目名称:ey_uhome,代码行数:31,代码来源:index.php

示例12: foreach

                 //当前用户组
                 $group = $_CACHE['system']['group'][$_G['manager']['gid']];
                 //插件名称
                 foreach ($res as $row) {
                     //仅显示可见工具
                     if (!in_array($row['widget'], $group['widget'][$row["appid"]])) {
                         continue;
                     }
                     $row["name"] = $_CACHE['system']['module'][$row["appid"]]["name"];
                     //模块路径
                     $mode = "module/" . $row["appid"];
                     //当前路径
                     $self = $mode . "/widget/" . $row['widget'] . "/";
                     //插件目录
                     $root = VI_ROOT . $self . "config.xml";
                     $xml = sreadfile($root);
                     $xml = str_replace(array('{HOST}', '{MODULE}', '{WIDGET}', '{APPID}', '{WGTID}'), array(VI_HOST, $mode, $self, $row["appid"], $row['widget']), $xml);
                     $xml = rawurlencode($xml);
                     $str .= ' {"appid":"' . $row["appid"] . '","widget":"' . $row['widget'] . '","name":"' . $row["name"] . '","x":"' . $row["x"] . '","y":"' . $row["y"] . '","z":"' . $row["z"] . '","fx":"' . $row["fx"] . '","fy":"' . $row["fy"] . '","xml":"' . $xml . '"},';
                 }
                 //返回数据
                 echo $callback . '([ ' . substr($str, 0, strlen($str) - 1) . ' ]);';
                 break;
         }
     }
     break;
     /////////////////////////////////////////////
     //处理附件
 /////////////////////////////////////////////
 //处理附件
 case "attach":
开发者ID:a195474368,项目名称:ejw,代码行数:31,代码来源:serv.php

示例13: check_filehash

 public static function check_filehash()
 {
     global $_G, $_CACHE;
     //更新基准目录
     $file = VI_ROOT . 'data/filehash/' . $_G['product']['charset'] . '.data';
     $text = sreadfile($file);
     $list = array_filter(explode("\n", $text));
     $result = array('stat' => 0, 'lost' => 0, 'newly' => 0, 'file' => array());
     //当前系统模块
     $module = array_keys($_CACHE['system']['module']);
     //当前文件清单
     $entrys = array();
     //没有找到特征
     if (count($list) == 0) {
         $result['stat'] = -1;
     }
     //////////////////////////
     foreach ($list as $item) {
         list($file, $hash, $size) = explode("\t", $item);
         $test = array('name' => $file, 'hash' => $hash);
         //获取模块标识
         $appid = Module::get_appid($file);
         //模块不存在
         if ($appid && in_array($appid, $module) === FALSE) {
             continue;
         }
         array_push($entrys, $file);
         //文件不存在
         if (file_exists(VI_ROOT . $file) === FALSE) {
             $test['lost'] = TRUE;
             $result['lost'] += 1;
         } else {
             if (md5_file(VI_ROOT . $file) === $hash) {
                 continue;
             }
             $test['size'] = filesize(VI_ROOT . $file);
             $test['change'] = filesize(VI_ROOT . $file) - $size;
             $test['mtime'] = filemtime(VI_ROOT . $file);
             $result['stat'] += 1;
         }
         array_push($result['file'], $test);
     }
     //////////////////////////
     //获取文件清单
     $list = rglob(VI_ROOT . '{*.php,*.js,*.htm,*.xml,*.sql,*.css}', GLOB_BRACE, array(VI_ROOT . '_doc', VI_ROOT . '_dir', VI_ROOT . '_src', VI_ROOT . '_tmp', VI_ROOT . 'cache', VI_ROOT . 'attach', VI_ROOT . 'module/special/content/data', VI_ROOT . 'module/special/content/html', VI_ROOT . 'module/special/content/article'));
     //修正 Win 各种路径
     $base = str_replace('\\', '/', VI_ROOT);
     //获取不在清单中文件
     foreach ($list as $file) {
         $name = str_replace(array('\\', $base), array('/', ''), $file);
         if (in_array($name, $entrys)) {
             continue;
         }
         array_push($result['file'], array('name' => $name, 'size' => filesize($file), 'mtime' => filemtime($file), 'newly' => TRUE));
         $result['stat'] += 1;
         $result['newly'] += 1;
     }
     //////////////////////////
     return $result;
 }
开发者ID:a195474368,项目名称:ejw,代码行数:60,代码来源:system.php

示例14: domain

 function domain($domain)
 {
     $find = "/<allow-access-from domain=\".*?\" \\/>/i";
     $replace = '<allow-access-from domain="*' . ($domain ? '.' . $domain : '') . '" />';
     $file = VI_ROOT . 'crossdomain.xml';
     $text = sreadfile($file);
     if (preg_match($find, $text)) {
         $text = preg_replace($find, $replace, $text);
         create_file($file, $text);
     }
 }
开发者ID:a195474368,项目名称:ejw,代码行数:11,代码来源:setting.php

示例15: fileparm

function fileparm($file, $parm = NULL)
{
    global $_G;
    $text = sreadfile($file);
    //处理单个参数
    if ($text && isset($parm)) {
        preg_match("/\\[{$parm}\\]([\\s\\S]*)\\[\\/{$parm}\\]/i", $text, $match);
        return iconv('UTF-8', $_G['product']['charset'], empty($match[1]) ? '' : $match[1]);
    }
    //一次性获取全部参数
    if ($text && $parm === NULL) {
        //获取全部参数
        preg_match_all("/\\[(.*?)\\]([\\s\\S]*)\\[\\/\\1\\]/", $text, $match);
        if ($match) {
            //合并成二维数组
            $array = array_combine($match[1], $match[2]);
            //将值转成当前编码
            $func = create_function('&$val, $key', '
			    global $_G;
			    $val = iconv( \'UTF-8\' , $_G[\'product\'][\'charset\'], $val );
			');
            /*
            $func = function( &$val, $key ) {
            	global $_G;
                $val = iconv( 'UTF-8' , $_G['product']['charset'], $val );
            };
            */
            array_walk($array, $func);
            return $array;
        }
    }
}
开发者ID:a195474368,项目名称:ejw,代码行数:32,代码来源:library.php


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