• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP makeDir函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: setUpDirectory

function setUpDirectory()
{
    //make source dir : source001, source 002 etc
    //make source file
    global $dir;
    makeDir();
    $source = stripslashes($_REQUEST['source']);
    file_put_contents($dir . '/source.cpp', $source);
}
开发者ID:habibruetian12,项目名称:onlinelabsystem,代码行数:9,代码来源:compiler-gcc-mingw.php


示例2: fileUpload

 function fileUpload($field)
 {
     $CI =& get_instance();
     $upload_config = $CI->config->item('upload_config');
     $upload_config['upload_path'] = makeDir($CI->config->item('upload_path'));
     $CI->load->library('upload', $upload_config);
     if (!$CI->upload->do_upload($field)) {
         return $CI->upload->display_errors();
     } else {
         return $CI->upload->data();
     }
 }
开发者ID:xiaopingL,项目名称:lcmedia,代码行数:12,代码来源:fb_common_helper.php


示例3: thumb_image_scale

function thumb_image_scale($width = 1, $height = 1, $partrelative = null, $partfull = '')
{
    $link2 = explode('/', $partfull);
    $name1 = $partrelative . '/' . $width . '/' . $height . '/' . $link2[count($link2) - 1];
    $name1 = $width . '/' . $height . '/' . $partrelative . $link2[count($link2) - 1];
    if (!file_exists(SITE_DIR_BASE . $partfull) || $partfull == '') {
        $name1 = SITE_DIR_BASE . 'notfound.jpg';
    }
    $check1 = explode('.', $partfull);
    if (!in_array($check1[count($check1) - 1], array('jpg', 'png', 'jpeg', 'gif'))) {
        $link1 = '';
    } else {
        $bien = getimagesize(DOMAIN_BASE . $partfull);
        $wimg = isset($bien[0]) ? $bien[0] : 1;
        //chieu rong thuc te
        $himg = isset($bien[1]) ? $bien[1] : 1;
        // chieu cao thuc te
        $x = $wimg;
        $y = $himg;
        $h = floor($wimg * $height / $width);
        if ($h <= $himg) {
            $y = $h;
        } else {
            $x = floor($y * $width / $height);
        }
        if ($x <= $width) {
            $tl = 100;
        } else {
            $tl = 100 - floor(($x - $width) * 100 / $x);
        }
        $link2 = explode('/', $partfull);
        $link1 = makeDir($name1);
        $name = 'tmp_' . $width . "x" . $height . '_' . $link2[count($link2) - 1];
        $name1 = $link1;
        $link1 = $link1 . $name;
        $name1 .= $link2[count($link2) - 1];
        if (!file_exists(SITE_DIR_BASE . $link1)) {
            $thumb = PhpThumbFactory::create(DOMAIN_BASE . $partfull);
            $thumb->cropFromCenter($x, $y);
            //$thumb->resizePercent($tl);
            $thumb->save(SITE_DIR_BASE . $link1);
            $thumb = PhpThumbFactory::create(SITE_DIR_BASE . $link1);
            $thumb->resizePercent($tl);
            $thumb->save(SITE_DIR_BASE . $name1);
            @unlink(SITE_DIR_BASE . $link1);
            header('Content-Type: image/jpeg');
            readfile(SITE_DIR_BASE . $name1);
            exit;
        }
    }
    return $name1;
}
开发者ID:manhvu1212,项目名称:videoplatform,代码行数:52,代码来源:index.php


示例4: Visitors

 /**
  * Initialise the Visitors object.
  */
 function Visitors()
 {
     global $PIVOTX;
     // Clean up user input to avoid HTML injection and/or stored XSS.
     // Also using strip_tags since none of the fields should contain HTML.
     $input = array_merge($_POST, $_GET);
     foreach ($input as $key => $value) {
         $input[$key] = htmlspecialchars(strip_tags(trim($value)));
     }
     $this->input = $input;
     $this->input['message'] = '';
     // Make sure the db/users/ folder is present.
     makeDir($PIVOTX['paths']['db_path'] . 'users/');
 }
开发者ID:laiello,项目名称:pivotx-sqlite,代码行数:17,代码来源:module_userreg.php


示例5: PagesFlat

    /**
     * Initialisation.
     *
     * @return PagesFlat
     */
    function PagesFlat()
    {
        global $PIVOTX;
        //init vars..
        static $initialisationchecks;
        if (!$initialisationchecks) {
            // Verify that the pages folder exists.
            if (!file_exists($PIVOTX['paths']['db_path'] . "pages")) {
                makeDir($PIVOTX['paths']['db_path'] . "pages");
            }
        }
        // Create the default pages. They can be recreated by setting
        // 'dont_recreate_default_pages' to 0 in the advanced config.
        if (!$initialisationchecks && !$PIVOTX['config']->get('dont_recreate_default_pages')) {
            $PIVOTX['config']->set('dont_recreate_default_pages', 1);
            $now = date("Y-m-d-H-i", getCurrentDate());
            $userdata = $PIVOTX['users']->getUsers();
            $username = $userdata[0]['username'];
            $this->index = $this->getIndex();
            $pages = array();
            $pages['1'] = array('user' => $username, 'sortorder' => 10, 'allow_comments' => 1, 'code' => 1, 'date' => $now . '-01', 'uri' => 'about', 'chapter' => 0, 'publish_date' => $now . '-01', 'edit_date' => $now . '-01', 'title' => __('About PivotX'), 'subtitle' => '', 'template' => '', 'introduction' => "<p>Hi! This website runs on <a href=\"http://pivotx.net\">PivotX</a>,\n                the coolest free and open tool to power your blog and website. To change this text, edit '<tt>About PivotX</tt>',\n                under '<tt>Pages</tt>' in the PivotX backend.</p>", 'body' => '<p>PivotX is a feature rich weblogging tool that is simple enough for the novice
weblogger to use and complex enough to meet the demands of advanced webmasters.
It can be used to publish a variety of websites from the most basic weblog to
very advanced CMS style solutions.</p>
<p>PivotX is - if we do say so ourselves - quite an impressive piece of software.
It is made even better through the use of several external libraries. We thank their
authors for the time taken to develop these very useful tools and for making
them available to others.</p>
<p>Development of PivotX (originally Pivot) started back in 2001 and has continuously
forged ahead thanks to the efforts of a lot of dedicated and very talented people. 
The PivotX core team is still very active but keep in mind that PivotX would not be 
what it is today without the valuable contributions made by several other people.</p>', 'convert_lb' => '', 'status' => 'publish', 'keywords' => '', 'uid' => 1, 'link' => '/page/welcome', 'extrafields' => array('image' => '', 'description' => ''));
            $pages['2'] = array('user' => $username, 'sortorder' => 10, 'allow_comments' => 1, 'code' => 2, 'date' => $now . '-01', 'uri' => 'links', 'chapter' => 0, 'publish_date' => $now . '-01', 'edit_date' => $now . '-01', 'title' => __('Links'), 'subtitle' => '', 'template' => '', 'introduction' => '<p>Some links to sites with more information:</p>
<ul>
<li>PivotX - <a href="http://pivotx.net">The PivotX website</a></li>
<li>Get help on <a href="http://forum.pivotx.net">the PivotX forum</a></li>
<li>Read <a href="http://book.pivotx.net">the PivotX documentation</a></li>
<li>Browse for <a href="http://themes.pivotx.net">PivotX Themes</a></li>
<li>Get more <a href="http://extensions.pivotx.net">PivotX Extensions</a></li>
<li>Follow <a href="http://twitter.com/pivotx">@pivotx on Twitter</a></li>
</ul>
<p><small>To change these links, edit \'<tt>Links</tt>\', under \'<tt>Pages</tt>\' in the PivotX backend.</small></p>', 'body' => '', 'convert_lb' => '', 'status' => 'publish', 'keywords' => '', 'uid' => 2, 'link' => '/page/about-pivotx', 'extrafields' => array('image' => '', 'description' => ''));
            for ($i = 1; $i < 3; $i++) {
                if (!file_exists($PIVOTX['paths']['db_path'] . "pages/page_{$i}.php")) {
                    $this->savePage($pages[$i]);
                }
            }
        }
        $initialisationchecks = true;
    }
开发者ID:laiello,项目名称:pivotx-sqlite,代码行数:55,代码来源:pages_flat.php


示例6: saveFile

/**
 * 保存文件
 *
 * @param string $fileName 文件名(含相对路径)
 * @param string $text 文件内容
 * @return boolean
 */
function saveFile($fileName, $text)
{
    if (!$fileName || !$text) {
        return false;
    }
    if (makeDir(dirname($fileName))) {
        if ($fp = fopen($fileName, "w")) {
            if (@fwrite($fp, $text)) {
                fclose($fp);
                return true;
            } else {
                fclose($fp);
                return false;
            }
        }
    }
    return false;
}
开发者ID:dlpc,项目名称:weathercollection,代码行数:25,代码来源:weather.php


示例7: makeDir

/**
 * Recursively creates chmodded directories. Returns true on success,
 * and false on failure.
 *
 * NB! Directories are created with permission 777 - worldwriteable -
 * unless you have set 'chmod_dir' to 0XYZ in the advanced config.
 *
 * @param string $name
 * @return boolean
 */
function makeDir($name)
{
    // if it exists, just return.
    if (file_exists($name)) {
        return true;
    }
    // If more than one level, try parent first..
    // If creating parent fails, we can abort immediately.
    if (dirname($name) != ".") {
        $success = makeDir(dirname($name));
        if (!$success) {
            return false;
        }
    }
    $mode_dec = octdec('0777');
    $oldumask = umask(0);
    $success = @mkdir($name, $mode_dec);
    @chmod($name, $mode_dec);
    umask($oldumask);
    return $success;
}
开发者ID:viyancs,项目名称:bolt,代码行数:31,代码来源:lib.php


示例8: upload

 public function upload()
 {
     error_reporting(0);
     $action = '';
     if (!empty($_GET['act'])) {
         $action = $_GET['act'];
     }
     if ($action == 'delimg') {
         $filename = $_POST['imagename'];
         if (!empty($filename)) {
             unlink('files/' . $filename);
             echo '1';
         } else {
             echo '删除失败。';
         }
     } else {
         $picname = $_FILES['mypic']['name'];
         $picsize = $_FILES['mypic']['size'];
         if ($picname != "") {
             if ($picsize > 10485760) {
                 echo '文件大小不能超过10M';
                 exit;
             }
             $upload_config = $this->config->item('upload_config');
             $upload_config['upload_path'] = makeDir($this->config->item('upload_path'));
             $ext = pathinfo($picname);
             $type = $ext['extension'];
             $allow_types = explode("|", $upload_config['allowed_types']);
             if (!in_array($type, $allow_types)) {
                 echo "文件格式不正确";
                 exit;
             }
             $pics = md5(date('YmdHis')) . '.' . $type;
             $path = $upload_config['upload_path'];
             //上传路径
             $pic_path = $path . $pics;
             move_uploaded_file($_FILES['mypic']['tmp_name'], $pic_path);
         }
         $size = round($picsize / 1024, 2);
         $arr = array('fileName' => $pics, 'filePath' => $path, 'origName' => str_replace("—", "-", $picname), 'fileExt' => '.' . $type, 'fileSize' => $size);
         $nameTitle = basename($arr['origName'], $arr['fileExt']);
         $length = mb_strlen($nameTitle);
         $lengthArr = 25 - $length;
         if ($lengthArr == 0) {
             //echo "<b style=color:red;font-size:16px;>标题不能超过25个字!</b>";
             //exit;
         }
         $signal = $this->PublicModel->insertSave('crm_file', $arr);
         if (!empty($signal)) {
             $arr['fid'] = $signal;
             $arr['bfs'] = '100';
         }
         $arr['nameTitle'] = $nameTitle;
         $arr['length'] = $lengthArr;
         $result = json_encode($arr);
         $data['rows'] = $result;
         echo $data['rows'];
     }
 }
开发者ID:xiaopingL,项目名称:lcmedia,代码行数:59,代码来源:EmailController.php


示例9: get_all_log_file

$key = $argv[1];
if (!$key) {
    echo "usage \$php getindex.php 'A', 'B' ...\n";
    exit;
}
$files = get_all_log_file("./data/{$key}/");
makeDir("./data/index/");
//存放论文目录,不会重复创建
makeDir("./data/index/{$key}");
foreach ($files as $file) {
    $fp = fopen($file, "r");
    $file = iconv("gb2312", "utf-8", $file);
    $subdir = basename($file, ".log");
    //$subdir = win_dir_format($subdir);
    $indexSavePath = "./data/index/{$key}/" . $subdir;
    makeDir($indexSavePath);
    $mapFile = $indexSavePath . "/paper_url_mapping.log";
    delFile($mapFile);
    $icount = 1;
    while ($line = readLine($fp)) {
        $arr = explode("\t", $line);
        $u = $arr[6];
        $paperName = $arr[0];
        $paperName = win_dir_format($paperName);
        //echo $paperName . "\n";
        $htmlFileName = $indexSavePath . "/" . $paperName . ".html";
        $tmpFile = iconv("utf-8", "gb2312//IGNORE", $htmlFileName);
        $dbCode = get_db_code($u);
        $fileName = get_file_name($u);
        $tableName = get_table_name($u);
        $realUrl = get_real_url($dbCode, $fileName, $tableName);
开发者ID:highestgoodlikewater,项目名称:cnkispider,代码行数:31,代码来源:getindex.php


示例10: getTargetDir

 /**
  * 获取保存的路径
  * @param string $dir 指定的保存目录
  * @return string
  */
 function getTargetDir($dir)
 {
     if ($dir == 'temp') {
         $dir = './public/upload/temp/' . date('Y/m/d/H', NULL);
     } else {
         $dir = './public/upload/' . $dir . '/' . date('Y/m/d', NULL);
     }
     makeDir(FANWE_ROOT . $dir);
     return $dir;
 }
开发者ID:Bingle-labake,项目名称:coollive.com.cn,代码行数:15,代码来源:image_lib.php


示例11: dirname

	if ($_POST['insert_as_user_id'] >0 && L_auth::isAdmin($userID) ) $flights_user_id=$_POST['insert_as_user_id']+0;
	else $flights_user_id=$userID;

	$randName=sprintf("%05d",rand(1, 10000) );
	
	$tmpZIPfolder=LEONARDO_ABS_PATH.'/'.$CONF['paths']['tmpigc'].'/zipTmp_'.$flights_user_id.'_'.$randName ;
	// $tmpZIPfolder=$flightsAbsPath."/".$flights_user_id."/flights/zipTmp".$randName ;
	$tmpZIPPath=LEONARDO_ABS_PATH.'/'.$CONF['paths']['tmpigc'].'/zipFile'.$flights_user_id.'_'.$randName.'.zip';
	//$tmpZIPPath=$flightsAbsPath."/".$flights_user_id."/flights/zipFile".$randName.".zip";
	
	move_uploaded_file($_FILES['zip_datafile']['tmp_name'], $tmpZIPPath );

	//delDir($tmpZIPfolder);
	//exec("unzip -o -j ".$tmpZIPPath." -d '".$tmpZIPfolder."'" );

	makeDir($tmpZIPfolder);
	require_once dirname(__FILE__)."/lib/pclzip/pclzip.lib.php";
	$archive = new PclZip($tmpZIPPath);
    $list 	 = $archive->extract(PCLZIP_OPT_PATH, $tmpZIPfolder,
                                PCLZIP_OPT_REMOVE_ALL_PATH,
								PCLZIP_OPT_BY_PREG, "/(\.igc)|(\.olc)$/i");

	echo "<b>List of uploaded igc/olc files</b><BR>";
	$f_num=1;
	foreach($list as $fileInZip) {
		echo "$f_num) ".$fileInZip['stored_filename']. ' ('.floor($fileInZip['size']/1024).'Kb)<br>';
		$f_num++;
	}
	flush2Browser();
	flush2Browser();
开发者ID:WooSeungho,项目名称:leonardoxc,代码行数:30,代码来源:GUI_flight_add_from_zip.php


示例12: saveAvatar

 public function saveAvatar($uid, $img)
 {
     $types = array('small' => '32', 'middle' => '64', 'big' => '160');
     $uid = sprintf("%09d", $uid);
     $dir1 = substr($uid, 0, 3);
     $dir2 = substr($uid, 3, 2);
     $dir3 = substr($uid, 5, 2);
     $file_path = PUBLIC_ROOT . './upload/avatar/' . $dir1 . '/' . $dir2 . '/' . $dir3;
     makeDir($file_path);
     $file_path .= '/' . substr($uid, -2) . '_';
     include_once fimport('class/image');
     $image = new Image();
     foreach ($types as $size => $wh) {
         $image->thumb($img, $wh, $wh, 1, true, $file_path . $size . '.jpg');
     }
     UserService::updateAvatar($uid);
     @unlink($img);
 }
开发者ID:BGCX261,项目名称:zhubao-tupu-svn-to-git,代码行数:18,代码来源:user.service.php


示例13: die

  include 'install/pages/install.html';
  die();
}

message('Создаем таблицы...');

install_sql('install/sql/drop.sql');
install_sql('install/sql/loops.sql');
install_sql('install/sql/patterns.sql');

message('Создаем директории...');

makeDir('loops/live');
makeDir('loops/dead');
makeDir('loops/custom');

if($_POST['install_type'] != 'bare') {
  message('Устанавливаем базовый контент...');

  install_sql('install/sql/default_loops.sql');
  install_sql('install/sql/default_patterns.sql');

  xcopy('install/media/dead', 'loops/dead');
  xcopy('install/media/live', 'loops/live');
}

if($_POST['install_type'] == 'extra') {
  message('Устанавливаем екстра контент...');

  install_sql('install/sql/extra_loops.sql');
开发者ID:Juribiyan,项目名称:gsap-l00ps,代码行数:30,代码来源:install.php


示例14: get_all_log_file

    exit;
}
$files = get_all_log_file("./data/{$key}/");
makeDir("./data/abstract/");
//存放论文摘要,不会重复创建
makeDir("./data/abstract/{$key}");
//’A' , 'B'...
$httpClient = new HttpClient("epub.cnki.net");
foreach ($files as $file) {
    $fp = fopen($file, "r");
    $file = iconv("gb2312", "utf-8", $file);
    $subdir = basename($file, ".log");
    $subdir = win_dir_format($subdir);
    $dataSavePath = "./data/abstract/{$key}/" . $subdir;
    makeDir($dataSavePath);
    makeDir($dataSavePath . "/tmp");
    $mapFile = $dataSavePath . "/paper_abstract_url.log";
    $icount = 1;
    while ($line = readLine($fp)) {
        $sleep = true;
        $arr = explode("\t", $line);
        $u = $arr[6];
        $paperName = $arr[0];
        $code = $arr[7];
        /*获取Referer头*/
        $dbCode = get_db_code($u);
        //CDFD
        $refUrl = get_ref($dbCode);
        $cachedHtml = $dataSavePath . "/tmp/{$paperName}.html";
        $absPath = $dataSavePath . "/" . $paperName . ".log";
        //echo "Cache check $cachedHtml...";
开发者ID:highestgoodlikewater,项目名称:cnkispider,代码行数:31,代码来源:abstract.php


示例15: newPkg

function newPkg()
{
    $pkg['vendor'] = cliInput("Package Vendor : ");
    $pkg['name'] = cliInput("Package Name : ");
    $pkg['description'] = cliInput("Package Description : ");
    $pkg['keywords'] = cliInput("Package Keywords : ");
    $pkg['license'] = cliInput("Package License : ");
    // $pkg['require'] = cliInput("Package Require : ");
    // $pkg['require-dev'] = cliInput("Package Require-dev : ");
    //
    makeDir(__DIR__ . "/" . $pkg['vendor']);
    makeDir(__DIR__ . "/" . $pkg['vendor'] . "/" . $pkg['name']);
    echo shell_exec("cd " . __DIR__ . "/" . $pkg['vendor'] . "/" . $pkg['name'] . " && git init");
    makeDir(__DIR__ . "/" . $pkg['vendor'] . "/" . $pkg['name'] . "/src");
    makeDir(__DIR__ . "/" . $pkg['vendor'] . "/" . $pkg['name'] . "/tests");
    makeDir(__DIR__ . "/" . $pkg['vendor'] . "/" . $pkg['name'] . "/src/config");
    makeDir(__DIR__ . "/" . $pkg['vendor'] . "/" . $pkg['name'] . "/src/controllers");
    makeDir(__DIR__ . "/" . $pkg['vendor'] . "/" . $pkg['name'] . "/src/translations");
    makeDir(__DIR__ . "/" . $pkg['vendor'] . "/" . $pkg['name'] . "/src/migrations");
    makeDir(__DIR__ . "/" . $pkg['vendor'] . "/" . $pkg['name'] . "/src/views");
    makeDir(__DIR__ . "/" . $pkg['vendor'] . "/" . $pkg['name'] . "/src/models");
    makeDir(__DIR__ . "/" . $pkg['vendor'] . "/" . $pkg['name'] . "/src/" . ucfirst($pkg['vendor']));
    makeDir(__DIR__ . "/" . $pkg['vendor'] . "/" . $pkg['name'] . "/src/" . ucfirst($pkg['vendor']) . "/" . ucfirst($pkg['name']));
    makeDir(__DIR__ . "/" . $pkg['vendor'] . "/" . $pkg['name'] . "/src/" . ucfirst($pkg['vendor']) . "/" . ucfirst($pkg['name']) . "/Facades");
    // Composer
    $temp = file_get_contents(__DIR__ . "/template/composer");
    $author = json_decode(@file_get_contents('author.json'), true);
    $keywords = explode(",", $pkg['keywords']);
    $find = ["<<PKGNAME>>", "<<PKGDESC>>", "<<LIC>>", "<<KEY>>", "<<AUTHNAME>>", "<<AUTHEMAIL>>", "<<REQ>>", "<<DEV>>", "<<AL>>"];
    $repl = [$pkg['vendor'] . "/" . $pkg['name'], $pkg['description'], $pkg['license'], json_encode($keywords), $author['name'], $author['email'], $pkg['require'], $pkg['require-dev'], ucfirst($pkg['vendor']) . "\\\\" . ucfirst($pkg['name'])];
    $temp = str_replace($find, $repl, $temp);
    file_put_contents(__DIR__ . "/" . $pkg['vendor'] . "/" . $pkg['name'] . "/composer.json", $temp);
    echo "composer.json created\n";
    // ServiceProvider
    $temp = file_get_contents(__DIR__ . "/template/ServiceProvider");
    $find = ["<<UCPKGPATH>>", "<<CLASS>>", "<<PKG>>", "<<PKGNAME>>"];
    $repl = [ucfirst($pkg['vendor']) . "\\" . ucfirst($pkg['name']), ucfirst($pkg['name']), strtolower($pkg['name']), $pkg['name']];
    $temp = str_replace($find, $repl, $temp);
    file_put_contents(__DIR__ . "/" . $pkg['vendor'] . "/" . $pkg['name'] . "/src/" . ucfirst($pkg['vendor']) . "/" . ucfirst($pkg['name']) . "/" . ucfirst($pkg['name']) . "ServiceProvider.php", $temp);
    echo "ServiceProvider created\n";
    // Main Class
    $temp = file_get_contents(__DIR__ . "/template/class");
    $find = ["<<UCPKGPATH>>", "<<CLASS>>"];
    $repl = [ucfirst($pkg['vendor']) . "\\" . ucfirst($pkg['name']), ucfirst($pkg['name'])];
    $temp = str_replace($find, $repl, $temp);
    file_put_contents(__DIR__ . "/" . $pkg['vendor'] . "/" . $pkg['name'] . "/src/" . ucfirst($pkg['vendor']) . "/" . ucfirst($pkg['name']) . "/" . ucfirst($pkg['name']) . ".php", $temp);
    echo "Main Class created\n";
    // Main Class
    $temp = file_get_contents(__DIR__ . "/template/facade");
    $find = ["<<UCPKGPATH>>", "<<CLASS>>", "<<NAME>>"];
    $repl = [ucfirst($pkg['vendor']) . "\\" . ucfirst($pkg['name']), ucfirst($pkg['name']), $pkg['name']];
    $temp = str_replace($find, $repl, $temp);
    file_put_contents(__DIR__ . "/" . $pkg['vendor'] . "/" . $pkg['name'] . "/src/" . ucfirst($pkg['vendor']) . "/" . ucfirst($pkg['name']) . "/Facades" . "/" . ucfirst($pkg['name']) . ".php", $temp);
    echo "Facade Class created\n";
    // Config
    file_put_contents(__DIR__ . "/" . $pkg['vendor'] . "/" . $pkg['name'] . "/src/config/config.php", file_get_contents(__DIR__ . "/template/config"));
    // ReadMe.md
    $temp = file_get_contents(__DIR__ . "/template/readme");
    $find = ["<<UNAME>>", "<<DESC>>", "<<UCPKG>>", '<<PKGPATH>>'];
    $repl = [ucfirst($pkg['name']), $pkg['description'], ucfirst($pkg['vendor']) . "\\" . ucfirst($pkg['name']), $pkg['vendor'] . '/' . $pkg['name']];
    $temp = str_replace($find, $repl, $temp);
    file_put_contents(__DIR__ . "/" . $pkg['vendor'] . "/" . $pkg['name'] . "/readme.md", $temp);
    echo "Readme created\n";
}
开发者ID:s1rxploit,项目名称:L5-Package-Generator,代码行数:64,代码来源:gen.php


示例16: createDirs

 function createDirs()
 {
     $pilotPath = $this->getAbsPath();
     if (!is_dir($pilotPath)) {
         makeDir($pilotPath);
     }
 }
开发者ID:Peter2121,项目名称:leonardoxc,代码行数:7,代码来源:CL_pilot.php


示例17: saveAvatar

 public function saveAvatar($uid, $img)
 {
     $types = array('small' => '32', 'middle' => '64', 'big' => '190');
     $avatar_status = UserService::getIsAvatar($uid);
     $uid = sprintf("%09d", $uid);
     $dir1 = substr($uid, 0, 3);
     $dir2 = substr($uid, 3, 2);
     $dir3 = substr($uid, 5, 2);
     $file_path = PUBLIC_ROOT . './upload/avatar/' . $dir1 . '/' . $dir2 . '/' . $dir3;
     makeDir($file_path);
     $file_path .= '/' . substr($uid, -2) . '_';
     include_once fimport('class/image');
     $image = new Image();
     foreach ($types as $size => $wh) {
         $image->thumb($img, $wh, $wh, 1, true, $file_path . $size . '.jpg');
     }
     if (!$avatar_status) {
         UserService::updateUserScore($uid, 'user', 'avatar');
     }
     FDB::query("UPDATE " . FDB::table('user') . " SET avatar_status = 1 WHERE uid='{$uid}'");
     @unlink($img);
 }
开发者ID:BGCX261,项目名称:zhubao-tupu-svn-to-git,代码行数:22,代码来源:user.service.php


示例18: getFlightFromIGC


//.........这里部分代码省略.........
                                 $prevPoint2 = new gpsPoint($line, $this->timezone);
                                 $prevPoint2->gpsTime += $day_offset;
                                 // update maximum speed
                                 if ($speed > $this->MAX_SPEED) {
                                     $this->MAX_SPEED = $speed;
                                 }
                                 $this->MEAN_SPEED += $speed;
                                 $MEAN_SPEED_POINTS++;
                                 // UPDATE MIN-MAX VARIO
                                 if ($vario > $this->MAX_VARIO) {
                                     $this->MAX_VARIO = $vario;
                                 }
                                 if ($vario < $this->MIN_VARIO) {
                                     $this->MIN_VARIO = $vario;
                                 }
                             }
                             //$speed=$data_speed[$iii-1]+0;
                             // $vario=$data_vario[$iii-1]+0;
                             // UPDATE MIN-MAX ALT
                             if ($alt > $this->MAX_ALT) {
                                 $this->MAX_ALT = $alt;
                             }
                             if ($alt < $this->MIN_ALT) {
                                 $this->MIN_ALT = $alt;
                             }
                             // end computing
                             $prevPoint = new gpsPoint($line, $this->timezone);
                             $prevPoint->gpsTime += $day_offset;
                             if ($mod >= 1) {
                                 if ($reduceArray[$points % $mod] == 0) {
                                     $outputLine = "";
                                 }
                             }
                         }
                         $points++;
                     }
                 }
             }
         }
         // end else
         $outputBuffer .= $outputLine;
     }
     // end main loop
     // echo "<HR>MIN VARIO".$this->MIN_VARIO."<HR>";
     //
     if ($stillOnGround && $this->LINEAR_DISTANCE < 50) {
         DEBUG("IGC", 1, "NO TAKEOFF FOUND: ");
         return 0;
         // no valid points found
     }
     $path_igc = dirname($this->getIGCFilename(1));
     if (!is_dir($path_igc)) {
         makeDir($path_igc, 0755);
     }
     /*write the full saned file */
     $fullSanedFile = '';
     foreach ($lines as $line) {
         $line = trim($line);
         if (strlen($line) == 0) {
             continue;
         }
         if ($line[0] == 'B' && $line[1] == 'X') {
             continue;
         }
         // MARKED BAD from BEFORE
         // if  ( strlen($line) < 23 || strlen($line) > 100  ) continue;
         $fullSanedFile .= $line . "\n";
     }
     if (!writeFile($this->getIGCFilename(2), $fullSanedFile)) {
         echo "Problem writing to file (" . $this->getIGCFilename(2) . ")";
     }
     DEBUG("IGC", 1, "<HR>" . $this->getIGCFilename(2) . ' size: ' . strlen($fullSanedFile) . "<HR>");
     // echo "<HR><HR>". $this->getIGCFilename(2) .strlen($fullSanedFile)."<HR><HR>";
     /* done wrting the full saned file */
     // write saned IGC file
     if (!writeFile($this->getIGCFilename(1), $outputBuffer)) {
         echo "Problem writing to file (" . $this->getIGCFilename(1) . ")";
     }
     // done write saned IGC file
     DEBUG("IGC", 1, "<HR>" . $this->getIGCFilename(1) . ' size: ' . strlen($outputBuffer) . "<HR>");
     if ($lastPoint) {
         $this->lastPointTM = $lastPoint->gpsTime;
         $this->lastLon = $lastPoint->lon();
         $this->lastLat = $lastPoint->lat();
         $this->LANDING_ALT = $lastPoint->getAlt();
         $this->END_TIME = $lastPoint->getTime();
     } else {
         $this->lastPointTM = 0;
         $this->lastLon = 0;
         $this->lastLat = 0;
         $this->LANDING_ALT = 0;
         $this->END_TIME = 0;
     }
     $this->DURATION = $this->END_TIME - $this->START_TIME;
     if ($this->DURATION < 0) {
         $this->DURATION += 86400;
     }
     $this->MEAN_SPEED = $this->MEAN_SPEED / $MEAN_SPEED_POINTS;
     return 1;
 }
开发者ID:Peter2121,项目名称:leonardoxc,代码行数:101,代码来源:CL_flightData.php


示例19: makeWritable

function makeWritable($path)
{
    if (!file_exists($path) && !makeDir($path)) {
        return 0;
    }
    @chmod($path, 0777);
    if (is_writable($path)) {
        return 1;
    } else {
        return 0;
    }
}
开发者ID:hung5s,项目名称:yap,代码行数:12,代码来源:init.php


示例20: main

function main($subDir, $class, $cookieURL, $indexURL, $totalClass, $curClass, $code)
{
    $isSleep = true;
    makeDir("./html/{$subDir}/{$class}/");
    $dataFileName = "data/{$subDir}/{$class}.log";
    $httpClient = new HttpClient("epub.cnki.net");
    $content = "";
    $indexFname = "./html/{$subDir}/{$class}/index.html";
    $tf = iconv("utf-8", "gb2312", $indexFname);
    $cookies = "";
    if (file_exists($tf)) {
        $isSleep = false;
        $content = file_get_contents($tf);
        echo "From cache get index.....\n";
    } else {
        /*获取并设置cookie*/
        $httpClient->get($cookieURL);
        $cookies = $httpClient->getCookies();
        $httpClient->setCookies($cookies);
        if (!$cookies) {
            die("cookie error");
        }
        $isSleep = true;
        $httpClient->get($indexURL);
        $content = $httpClient->getContent();
        save($indexFname, $content);
        //保存
        echo "save index file...\n";
    }
    /* 解析出一共有多少页面 */
    $pageCount = parsePageCount($content);
    echo "Page is {$pageCount} ****\n";
    $articleCount = ARTICLE_PRE_PAGE * $pageCount;
    //计算一共有多少篇文章,大于等于实际文章数目,不影响结果
    echo "total article is {$articleCount}\n";
    $pageCount = $articleCount / ARTICLE_PRE_PAGE;
    $pageCount = ceil($pageCount);
    //向上取整,不放过任何数据
    if ($pageCount == 0) {
        $pageCount = 1;
    }
    if ($pageCount > 50) {
        echo "page count is big than 50\n";
    }
    echo "total page of {$class} is : {$pageCount}...............{$curClass} of {$totalClass}\n";
    if ($isSleep) {
        fakeSleep();
    }
    /* 抓取每一个页面并且保存下来,保存的同时进行解析 */
    for ($i = 1; $i <= $pageCount; $i++) {
        $content = NULL;
        $pageI = getPageI($indexURL, $i);
        //第i页的地址
        $htmlI = "./html/{$subDir}/{$class}/{$i}.html";
        if (!file_exists(iconv("utf-8", "gb2312", $htmlI))) {
            $isSleep = true;
            $httpClient->setCookies($cookies);
            $httpClient->get($pageI);
            $content = $httpClient->getContent();
            save($htmlI, $content);
            echo "From newwork & save {$i}.html..........[{$i} of {$pageCount}]\n";
        } else {
            $tmpf2 = iconv("utf-8", "gb2312", $htmlI);
            $content = file_get_contents($tmpf2);
            $ok = validatePageContent($content);
            //是否出现了验证码
            if (!$ok) {
                $i = $i - 1;
                delFile($htmlI);
            } else {
                $isSleep = false;
                echo "Find local file {$htmlI} & skip\n";
            }
            //continue;
        }
        $logName = "./data/{$subDir}/{$class}.log";
        if (!validatePageContent($content)) {
            $i = $i - 1;
            delFile($htmlI);
            dosleep(60);
            $httpClient = new HttpClient("epub.cnki.net");
            $httpClient->get($cookieURL);
            $cookies = $httpClient->getCookies();
            $httpClient->setCookies($cookies);
            continue;
        }
        parseContent($content, $logName, $code);
        if ($i != $pageCount && $isSleep) {
            fakeSleep();
        } else {
            echo "+\n";
            echo "+\n";
            echo "+ {$class} done\n";
            echo "+\n";
            echo "+\n";
        }
    }
}
开发者ID:highestgoodlikewater,项目名称:cnkispider,代码行数:98,代码来源:function.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP makeDirectory函数代码示例发布时间:2022-05-15
下一篇:
PHP makeCryptPassword函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap