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


PHP tool::mkdir方法代码示例

本文整理汇总了PHP中tool::mkdir方法的典型用法代码示例。如果您正苦于以下问题:PHP tool::mkdir方法的具体用法?PHP tool::mkdir怎么用?PHP tool::mkdir使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在tool的用法示例。


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

示例1: make_show_action


//.........这里部分代码省略.........
             	if(!in_array($case->view->archive['catid'],$sonids) && intval(setting::$var['archive'][$key]['catid'])){
             		//unset($case->view->field[$key]);
             		continue;
             	}
             	$str .= '<p> '.setting::$var['archive'][$key]['cname'].':'. $value.'</p>';
             }
             $arc['my_fields'] = $str;
             
             //上一篇,下一篇
             $aid = $case->view->archive['aid'];
             $catid = $case->view->archive['catid'];
             $sql1 = "SELECT * FROM `{$archive->name}` WHERE catid = '$catid' AND aid > '$aid' ORDER BY aid ASC LIMIT 0,1";
             $sql2 = "SELECT * FROM `{$archive->name}` WHERE catid = '$catid' AND aid < '$aid' ORDER BY aid DESC LIMIT 0,1";
             $n = $archive->rec_query_one($sql1);
             $p = $archive->rec_query_one($sql2);
             $case->view->archive['p'] = $p;
             $case->view->archive['n'] = $n;
             $case->view->archive['p']['url'] = archive::url($p);
             $case->view->archive['n']['url'] = archive::url($n);
             
             //评级
             $case->view->archive['strgrade'] = archive::getgrade($arc['grade']);
             
             //图片
             $case->view->archive['pics'] = unserialize($case->view->archive['pics']);
             if(is_array($case->view->archive['pics']) && !empty($case->view->archive['pics'])){
             	foreach ($case->view->archive['pics'] as $k => $v){
             		if(strtolower(substr($v,0,7)) == 'http://'){
             			$case->view->archive['pics'][$k] = $v;
             		}else{
             			$case->view->archive['pics'][$k] = $v;
             		}
             	}
             }
             $case->view->archive['pics'] = serialize($case->view->archive['pics']);
             
             if ($template && file_exists(TEMPLATE . '/' . $case->view->_style . '/' . $template))
                 $tpl = $template;
             else
                 $tpl = category::gettemplate($case->view->catid, 'showtemplate');
             $content = $case->fetch($tpl);
             $path = ROOT . archive::url($case->view->archive, front::$get['page'] > 1 ? front::$get['page'] : null, true);
             if (!preg_match('/\.[a-zA-Z]+$/', $path))
                 $path = rtrim(rtrim($path, '/'), '\\') . '/index.html';
             $path = rtrim($path, '/');
             $path = rtrim($path, '\\');
             $path = str_replace('//', '/', $path);
             tool::mkdir(dirname($path));
             file_put_contents($path, $content);
             $cpage++;
             if ($case->view->pages > 1 && $c == 1) {
                 $path = ROOT . archive::url($case->view->archive, 1, true);
                 if (!preg_match('/\.[a-zA-Z]+$/', $path))
                     $path = rtrim(rtrim($path, '/'), '\\') . '/index.html';
                 $path = rtrim($path, '/');
                 $path = rtrim($path, '\\');
                 $path = str_replace('//', '/', $path);
                 tool::mkdir(dirname($path));
                 //file_put_contents('logs.txt', file_get_contents('logs.txt')."\r\n".$path);
                 $f = fopen($path,'w');
                 fwrite($f, $content);
                 fclose($f);
                 $cpage++;
             }
         }
     }
     $totalpage = count($archives);
     if (!isset($archives[0]))
         $totalpage = 0;
     if ($make_page >= $make_page_num) {
         $show_msg = "本组生成html <b>{$cpage}</b> 页!  生成html完毕,本次共生成 <b>{$archive_num}</b> 页! 3秒后自动返回内容生成首页面!\n";
         $c_url = preg_replace('#&make_page=(\d+)#', '', $_SERVER['QUERY_STRING']);
         $c_url = preg_replace('#&aid_start=(\d+)#', '', $c_url);
         $c_url = preg_replace('#&aid_end=(\d+)#', '', $c_url);
         $c_url = preg_replace('#&catid=(\d+)#', '', $c_url);
         $c_url = preg_replace('#&submit=(\d+)#', '', $c_url);
         $c_url = 'index.php?' . $c_url;
     } else {
         $show_msg = "第 <b>{$make_page}</b> 组成功生成html <b>{$cpage}</b> 页! 本次共需生成 <b>{$archive_num}</b> 页! 已经生成 <b>" . ($make_page * $group_count) . "</b> 页! 3秒后自动跳入下组生成!\n";
     }
     $getnexturl = "<script>";
     $getnexturl.="var t=4;\n";
     $getnexturl.="setInterval('testTime()',3000);\n";
     $getnexturl.="function testTime() \n";
     $getnexturl.=" { \n";
     $getnexturl.="if(t == 0) location = '" . $c_url . "'; \n";
     $getnexturl.=" t--;\n";
     $getnexturl.="}\n</script> \n";
     if ($cpage > 0) {
         if (!config::get('group_on')) {
             front::flash("成功生成html <b>{$cpage}</b> 页!用时".time::getTime()."!\n");
         } else {
             front::flash($show_msg . "\n" . $getnexturl);
         }
     } else {
         front::flash("没有需要生成的html,可能您选择的栏目暂无内容或者网站并未开启内容生成静态功能!");
     }
     front::$admin = true;
     front::$post = $post;
 }
开发者ID:jiangsuei8,项目名称:public_php_shl,代码行数:101,代码来源:cache_admin.php

示例2: run

    function run($attachment) {
        $this->max_size=config::get('upload_max_filesize') * 1024000;
        if (!isset($this->url_pre))
            $this->url_pre='upload/'.$this->dir.'/'.date('Ym');
        $this->path=ROOT.'/'.$this->url_pre;
        tool::mkdir($this->path);
        if (!$attachment['name']) {

            return false;
        }
        $new_name=$new_name_gbk=str_replace('.','',Time::getMicrotime()).'.'.end(explode('.',$attachment['name']));
        $content=file_get_contents($attachment['tmp_name']);
        if (!front::checkstr($content)) {
            return false;
        }
        
        if (strlen($content) >$this->max_size) {
            return false;
        }
        
        if(!in_array(end(explode('.',$attachment['name'])), $this->type)){
            return false;
        }
        move_uploaded_file($attachment['tmp_name'],$this->path.'/'.$new_name_gbk);
        $this->save_path=$this->path.'/'.$new_name_gbk;
        if ($_GET['site'] != 'default') {
            $ftp=new nobftp();
            $ftpconfig=config::get('website');
            $ftp->connect($ftpconfig['ftpip'],$ftpconfig['ftpuser'],$ftpconfig['ftppwd'],$ftpconfig['ftpport']);
            $ftperror=$ftp->returnerror();
            if ($ftperror) {
                exit($ftperror);
            }
            else {
                $ftp->nobchdir($ftpconfig['ftppath']);
                $ftp->nobput($ftpconfig['ftppath'].'/'.$this->url_pre.'/'.$new_name,$this->save_path);
            }
        }
        return $this->url_pre.'/'.$new_name;
    }
开发者ID:jiangsuei8,项目名称:public_php_shl,代码行数:40,代码来源:front_class.php

示例3: savepic1

function savepic1($out) {
	$domain = front::domain();
	preg_match('@http://([^/|\s]*)@is', $out[2], $out1);
	$opts = array(
			'http' => array(
					'method' => "GET",
					'timeout' => 30,
			)
	);
	$ext = end(explode('.', basename($out[2])));
	$arr = array('jpg', 'gif', 'png'); //自动保存的图片类型
	if (in_array($ext, $arr)) {  //是否图片
		if ($domain != $out1[1] && $out1[1]) {  //是否外站图片
			$context = stream_context_create($opts);
			$content = @file_get_contents($out[2], false, $context);
			if ($content) {  //读取是否成功
				$dir = 'upload/images/' . date('Ym') . '/';
				tool::mkdir($dir);
				$name = $dir . time().mt_rand(10, 99) .'.' . $ext;
				$newname = config::get('site_url') . $name;
				if (file_put_contents($name, $content)) { //写入是否成功
					return $out[1] . $newname;
				} else {
					return '';
				}
			} else {
				return '';
			}
		} else {
			return $out[2];
		}
	}
	return '';
}
开发者ID:jiangsuei8,项目名称:public_php_shl,代码行数:34,代码来源:userfunction.php


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