本文整理匯總了PHP中makeDir函數的典型用法代碼示例。如果您正苦於以下問題:PHP makeDir函數的具體用法?PHP makeDir怎麽用?PHP makeDir使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了makeDir函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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);
}
示例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();
}
}
示例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;
}
示例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/');
}
示例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;
}
示例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;
}
示例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;
}
示例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'];
}
}
示例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);
示例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;
}
示例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();
示例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);
}
示例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');
示例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...";
示例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";
}