本文整理汇总了PHP中mkdirs函数的典型用法代码示例。如果您正苦于以下问题:PHP mkdirs函数的具体用法?PHP mkdirs怎么用?PHP mkdirs使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了mkdirs函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: uploadCert
function uploadCert($fileId)
{
$managerId = $this->mid;
$path = SITE_PATH . '\\Cert\\wxzf\\' . $managerId;
$file = M('file')->find($fileId);
$file['savepath'] = substr($file['savepath'], 0, strlen($file['savepath']) - 1);
$filename = SITE_PATH . '\\Uploads\\Download\\' . $file['savepath'] . '\\' . $file['savename'];
// dump($file);
// dump($filename);
// dump(file_exists($filename));
// die;
if (!file_exists($filename)) {
$this->error('上传失败');
exit;
}
// $extend = $file ['ext'];
// if (! ($extend == 'pem' || $extend == 'p12' )) {
// $this->error('上传证书格式有误,扩展名应为 pem');
// exit();
// }
$mkres = mkdirs($path);
$content = wp_file_get_contents($filename);
$res = file_put_contents($path . '\\' . $file['name'], $content);
return $res;
}
示例2: settingsDisplay
public function settingsDisplay($settings)
{
global $_GPC, $_W;
if (checksubmit()) {
load()->func('file');
mkdirs(ZC_ROOT . '/cert');
$r = true;
$pemname = isset($pemname) ? $pemname : time();
if (!empty($_GPC['cert'])) {
$ret = file_put_contents(ZC_ROOT . '/cert/apiclient_cert.pem.' . $pemname, trim($_GPC['cert']));
$r = $r && $ret;
}
if (!empty($_GPC['key'])) {
$ret = file_put_contents(ZC_ROOT . '/cert/apiclient_key.pem.' . $pemname, trim($_GPC['key']));
$r = $r && $ret;
}
if (!empty($_GPC['ca'])) {
$ret = file_put_contents(ZC_ROOT . '/cert/rootca.pem.' . $pemname, trim($_GPC['ca']));
$r = $r && $ret;
}
if (!$r) {
message('证书保存失败, 请保证 /addons/hx_zhongchou/cert/ 目录可写');
}
$cfg = array('noticeemail' => $_GPC['noticeemail'], 'kfid' => $_GPC['kfid'], 'k_templateid' => $_GPC['k_templateid'], 'kfirst' => $_GPC['kfirst'], 'kfoot' => $_GPC['kfoot'], 'm_templateid' => $_GPC['m_templateid'], 'mfirst' => $_GPC['mfirst'], 'mfoot' => $_GPC['mfoot'], 'ispublish' => intval($_GPC['ispublish']), 'shopname' => $_GPC['shopname'], 'address' => $_GPC['address'], 'phone' => $_GPC['phone'], 'email' => $_GPC['email'], 'officialweb' => $_GPC['officialweb'], 'description' => htmlspecialchars_decode($_GPC['description']), 'appid' => trim($_GPC['appid']), 'secret' => trim($_GPC['secret']), 'mchid' => trim($_GPC['mchid']), 'password' => trim($_GPC['password']), 'ip' => trim($_GPC['ip']), 'pemname' => $pemname);
if (!empty($_GPC['logo'])) {
$cfg['logo'] = $_GPC['logo'];
}
if ($this->saveSettings($cfg)) {
message('保存成功', 'refresh');
}
}
load()->func('tpl');
include $this->template('setting');
}
示例3: settingsDisplay
public function settingsDisplay($settings)
{
global $_W, $_GPC, $frames;
require_once MB_ROOT . '/source/backlist.class.php';
$backlist = new backlist();
$frames = $backlist->getModuleFrames('feng_fightgroups');
$backlist->_calc_current_frames2($frames);
load()->func('tpl');
load()->model('account');
$modules = uni_modules();
if (checksubmit()) {
load()->func('file');
$r = mkdirs(MB_ROOT . '/cert/' . $_W['uniacid']);
if (!empty($_GPC['cert'])) {
$ret = file_put_contents(MB_ROOT . '/cert/' . $_W['uniacid'] . '/apiclient_cert.pem', trim($_GPC['cert']));
$r = $r && $ret;
}
if (!empty($_GPC['key'])) {
$ret = file_put_contents(MB_ROOT . '/cert/' . $_W['uniacid'] . '/apiclient_key.pem', trim($_GPC['key']));
$r = $r && $ret;
}
if (!$r) {
message('证书保存失败, 请保证 /addons/feng_fightgroups/cert/ 目录可写');
}
$dat = array('userrefund' => $_GPC['userrefund'], 'gettime' => $_GPC['gettime'], 'goodstip' => $_GPC['goodstip'], 'openfirstpay' => $_GPC['openfirstpay'], 'firstpay' => $_GPC['firstpay'], 'refundpercent' => $_GPC['refundpercent'], 'status' => $_GPC['status'], 'sharestatus' => $_GPC['sharestatus'], 'mode' => $_GPC['mode'], 'picmode' => $_GPC['picmode'], 'mchid' => $_GPC['mchid'], 'apikey' => $_GPC['apikey'], 'share_title' => $_GPC['share_title'], 'share_image' => $_GPC['share_image'], 'share_desc' => $_GPC['share_desc'], 'share_imagestatus' => $_GPC['share_imagestatus'], 'pay_suc' => $_GPC['pay_suc'], 'm_pay' => $_GPC['m_pay'], 'm_tuan' => $_GPC['m_tuan'], 'm_cancle' => $_GPC['m_cancle'], 'm_ref' => $_GPC['m_ref'], 'm_send' => $_GPC['m_send'], 'pay_remark' => $_GPC['pay_remark'], 'tuan_remark' => $_GPC['tuan_remark'], 'tuan_suc' => $_GPC['tuan_suc'], 'cancle_remark' => $_GPC['cancle_remark'], 'cancle' => $_GPC['cancle'], 'send_remark' => $_GPC['send_remark'], 'send' => $_GPC['send'], 'ref_remark' => $_GPC['ref_remark'], 'ref' => $_GPC['ref'], 'sname' => $_GPC['sname'], 'slogo' => $_GPC['slogo'], 'marketprice1' => $_GPC['marketprice1'], 'marketprice2' => $_GPC['marketprice2'], 'marketprice3' => $_GPC['marketprice3'], 'marketprice4' => $_GPC['marketprice4'], 'productprice1' => $_GPC['productprice1'], 'productprice2' => $_GPC['productprice2'], 'productprice3' => $_GPC['productprice3'], 'productprice4' => $_GPC['productprice4'], 'copyright' => $_GPC['copyright'], 'content' => htmlspecialchars_decode($_GPC['content']));
if ($this->saveSettings($dat)) {
message('保存成功', 'refresh');
}
}
//这里来展示设置项表单
include $this->template('web/setting');
}
示例4: Write
/**
* Function used to write a new cache file
*
* This function will create a new JSON file in which the payload will be saved for the specified amount. By default the cached data needs to be renewed manually.
*
* @param string $name The name under which the cached data will be saved.
* @param mixed $payload Any data to be stored in this cache file (strings, integers, arrays, ...)
* @param int $lifetime How long should the data be kept (in minutes). 0 means infinite.
* @param bool $created Setting this to true will automatically create the folders needed to store the given cache key
*
* @return bool Whether or not the operation succeeded.
*/
static function Write($name, $payload, $lifetime = 0, $create = false)
{
if (CACHE) {
if (!is_dir(CACHE_DIR . dirname($name))) {
if ($create) {
mkdirs(CACHE_DIR . dirname($name));
} else {
return false;
}
}
$time = time();
// Get current time so we can use it for lifetime calculation
if ($lifetime != 0) {
$expires = $time + $lifetime * 60;
} else {
$expires = 0;
}
$data = array('name' => $name, 'created' => $time, 'expires' => $expires, 'lifetime' => $lifetime, 'payload' => $payload);
file_put_contents(CACHE_DIR . $name . '.json', json_encode($data));
Lightwork::Log('Cache stored: ' . $name, Lightwork::LOG_DEBUG);
return true;
} else {
return false;
}
}
示例5: __construct
/**
* Constructor
*
* @param string $tpl_name, Name of Template for rendering
*/
public function __construct($tpl_name)
{
$this->tpl_driver_class = Config::get('env.tplclass', 'Smarty');
$this->tpl_postfix = Config::get('env.tplpostfix', '.htm');
$this->tpl_name = $this->tpl_realpath($tpl_name);
$this->modroot = SimPHP::$gConfig['modroot'];
$tpl_config = array('caching' => Config::get('env.tplcache', 0), 'cache_lifetime' => Config::get('env.tplcache_expires', 300), 'compile_check' => Config::get('env.tplcompile_check', 1), 'force_compile' => Config::get('env.tplforce_compile', 0), 'debugging' => Config::get('env.tpldebug', 0));
$tpldir = Config::get('env.sitetheme', 'default');
if ($this->modroot != 'modules') {
$tpldir = $this->modroot;
}
$template_dir = SIMPHP_ROOT . "/themes/{$tpldir}";
$compiled_dir = SIMPHP_ROOT . Config::get('env.tplcachedir') . "/{$tpldir}/compiled";
$cached_dir = SIMPHP_ROOT . Config::get('env.tplcachedir') . "/{$tpldir}/cached";
$tpl_config['template_dir'] = $template_dir;
$tpl_config['compile_dir'] = $compiled_dir;
$tpl_config['cache_dir'] = $cached_dir;
try {
if (!is_dir($compiled_dir) && !mkdirs($compiled_dir) && !is_writable($compiled_dir)) {
throw new DirWritableException($compiled_dir);
}
if (Config::get('env.tplcache') && !is_dir($cached_dir) && !mkdirs($cached_dir) && !is_writable($cached_dir)) {
throw new DirWritableException($cached_dir);
}
} catch (DirWritableException $e) {
trigger_error($e->getMessage(), E_USER_ERROR);
}
$this->tpl = Template::I(array('driverClass' => $this->tpl_driver_class, 'driverConfig' => $tpl_config));
$this->assign('contextpath', Config::get('env.contextpath', '/'));
$this->assign_by_ref('user', $GLOBALS['user']);
//add default output filter
$this->add_output_filter(array($this, 'filter_output'));
}
示例6: settingsDisplay
public function settingsDisplay($settings)
{
global $_W, $_GPC;
load()->func('tpl');
if (checksubmit()) {
load()->func('file');
$r = mkdirs(MB_ROOT . '/cert/' . $_W['uniacid']);
if (!empty($_GPC['cert'])) {
$ret = file_put_contents(MB_ROOT . '/cert/' . $_W['uniacid'] . '/apiclient_cert.pem', trim($_GPC['cert']));
$r = $r && $ret;
}
if (!empty($_GPC['key'])) {
$ret = file_put_contents(MB_ROOT . '/cert/' . $_W['uniacid'] . '/apiclient_key.pem', trim($_GPC['key']));
$r = $r && $ret;
}
if (!$r) {
message('证书保存失败, 请保证 /addons/feng_fightgroups/cert/ 目录可写');
}
$dat = array('status' => $_GPC['status'], 'mode' => $_GPC['mode'], 'picmode' => $_GPC['picmode'], 'mchid' => $_GPC['mchid'], 'apikey' => $_GPC['apikey'], 'share_title' => $_GPC['share_title'], 'share_image' => $_GPC['share_image'], 'share_desc' => $_GPC['share_desc'], 'url' => $_GPC['url'], 'pay_suc' => $_GPC['pay_suc'], 'm_pay' => $_GPC['m_pay'], 'm_tuan' => $_GPC['m_tuan'], 'm_cancle' => $_GPC['m_cancle'], 'm_ref' => $_GPC['m_ref'], 'm_send' => $_GPC['m_send'], 'pay_remark' => $_GPC['pay_remark'], 'tuan_remark' => $_GPC['tuan_remark'], 'tuan_suc' => $_GPC['tuan_suc'], 'cancle_remark' => $_GPC['cancle_remark'], 'cancle' => $_GPC['cancle'], 'send_remark' => $_GPC['send_remark'], 'send' => $_GPC['send'], 'ref_remark' => $_GPC['ref_remark'], 'ref' => $_GPC['ref'], 'sname' => $_GPC['sname'], 'slogo' => $_GPC['slogo'], 'copyright' => $_GPC['copyright'], 'content' => htmlspecialchars_decode($_GPC['content']));
if ($this->saveSettings($dat)) {
message('保存成功', 'refresh');
}
}
//这里来展示设置项表单
include $this->template('setting');
}
示例7: logging
function logging($level = 'info', $message = '')
{
$filename = IA_ROOT . '/data/logs/' . date('Ymd') . '.log';
load()->func('file');
mkdirs(dirname($filename));
$content = date('Y-m-d H:i:s') . " {$level} :\n------------\n";
if (is_string($message)) {
$content .= "String:\n{$message}\n";
}
if (is_array($message)) {
$content .= logging_implode($message);
}
if ($message == 'get') {
$content .= "GET:\n";
foreach ($_GET as $key => $value) {
$content .= sprintf("%s : %s ;\n", $key, $value);
}
}
if ($message == 'post') {
$content .= "POST:\n";
foreach ($_POST as $key => $value) {
$content .= sprintf("%s : %s ;\n", $key, $value);
}
}
$content .= "\n";
$fp = fopen($filename, 'a+');
fwrite($fp, $content);
fclose($fp);
}
示例8: template_compile
function template_compile($from, $to) {
$path = dirname($to);
if (!is_dir($path))
mkdirs($path);
$content = template_parse(file_get_contents($from));
file_put_contents($to, $content);
}
示例9: create_tpl
public function create_tpl()
{
mkdirs(APP_TPL . 'Index');
if (file_exists(APP_TPL . 'Index/index.html')) {
return;
}
$str = <<<EOT
<html>
<head>
\t<title>框架测试页面内容</title>
\t<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
</head>
<body>
\t<div style="margin 100px auto"><h2><{\$val}></h2></div>
\t<div style="margin 100px auto"><h2><{if (1 == 1)}>IF 语句的测试1<{/if}></h2></div>
\t<div style="margin 100px auto"><h2><{if (1 == 2)}>IF 语句的测试2<{/if}></h2></div>
\t<div style="margin 100px auto">
\t\t<h2>
\t\t\t<h1>第一种循环例子</h1>
\t\t\t<{ foreach (\$tarr as \$t)}>
\t\t\t<{\$t}><br/>
\t\t\t<{/foreach}>
\t\t\t<h1>第二种循环例子</h1>
\t\t\t<{ loop (\$tarr as \$t) }>
\t\t\t<{\$t}><br/>
\t\t\t<{/loop}>
\t\t</h2>
\t</div>
</body>
</html>
EOT;
file_put_contents(APP_TPL . 'Index/index.html', $str);
}
示例10: index
public function index()
{
$qrcode_width = intval($_GET['qw']);
$qrcode_height = intval($_GET['qh']);
$qrcode_type = trim($_GET['qt']);
$qrcode_content = trim($_GET['qc']);
$qrcode_logo = trim($_GET['ql']);
$hash = md5($qrcode_content . $qrcode_width . $qrcode_height . $qrcode_type . $qrcode_logo);
$map = array('hash' => $hash);
$one = D('qrcode')->field('file_path')->where($map)->find();
if ($one) {
$qrcode_file = $one['file_path'];
} else {
$file_dir = 'Uploads/' . date('Y') . '/' . date('m') . '/' . date('d');
mkdirs($file_dir);
$qrcode_file = $file_dir . '/' . $hash . '.png';
}
//$qrcode_content = htmlspecialchars_decode($qrcode_content);
if (!$one) {
qrcode($qrcode_file, $qrcode_content, $qrcode_logo, $qrcode_width, $qrcode_height, $qrcode_type);
//保存到数据库
$data = array('hash' => $hash, 'width' => $qrcode_width, 'height' => $qrcode_height, 'logo' => $qrcode_logo, 'content' => $qrcode_content, 'file_path' => $qrcode_file, 'dateline' => time());
D('qrcode')->add($data);
}
$qrcode_url = 'http://' . $_SERVER['HTTP_HOST'] . '/' . $qrcode_file;
//qrcode
$qrcode_href = 'http://' . $_SERVER['HTTP_HOST'] . '/qr.html?hash=' . $hash;
$this->assign('qrcode_width', $qrcode_width);
$this->assign('qrcode_height', $qrcode_height);
$this->assign('qrcode_url', $qrcode_url);
$this->assign('qrcode_href', $qrcode_href);
$this->display();
}
示例11: AddMsg_User
function AddMsg_User($uid, $msg)
{
mkdirs(ONEZ_ROOT . './onezdata/message/users');
$file = ONEZ_ROOT . './onezdata/message/users/' . $uid . '.php';
!file_exists($file) && writeover($file, '<?php die();?>');
writeover($file, $msg, "a+");
}
示例12: view_orderWeighing
public function view_orderWeighing()
{
$config_path = 'images/cz';
$time = date("Y/m/d", time());
$dirPath = $config_path . '/' . $time;
if (!is_dir($dirPath)) {
mkdirs($dirPath, 0777);
}
$this->smarty->assign('time', $time);
$navlist = array(array('url' => '', 'title' => '出库'), array('url' => 'index.php?mod=waitWeighing&act=waitWeighingList', 'title' => '待称重'), array('url' => '', 'title' => '称重扫描<小包>'));
$secnev = 3;
$toplevel = 2;
$secondlevel = 26;
//$userName = $_SESSION['username'];
//$this->smarty->assign('secnev','1');
$this->smarty->assign('navlist', $navlist);
$this->smarty->assign('secnev', $secnev);
$this->smarty->assign('toplevel', $toplevel);
$this->smarty->assign('secondlevel', $secondlevel);
$partion_list = CommonModel::getChannelNameByIds('all');
//$channel_list = CommonModel::getCarrierChannelByIds('all');
$channel_list = C('MAILWAYCONFIG');
$this->smarty->assign("partion_list", $partion_list);
$this->smarty->assign("channel_list", $channel_list);
//$this->smarty->assign('toptitle', '货品资料管理');
$this->smarty->display('orderWeighing.htm');
}
示例13: createCache
/**
* 生成缓存文件
*/
public function createCache()
{
$path_file = UPLOAD_PATH . '/cache/';
$file_name = $path_file . date('Ymd', time()) . '.txt';
if (!file_exists($file_name)) {
foreach ($data2 as $v) {
$pinyin = $this->pinyin($v['name']);
$array['arr'][] = [$pinyin => $v['name']];
}
$data3 = $this->m['columns']->getAllByField('module', 'ksys', 'id');
$data4 = $this->m['article']->getAll(arrayToString($data3), 'title');
foreach ($data4 as $v) {
$pinyin = $this->pinyin($v['title']);
$array['arr'][] = [$pinyin => $v['title']];
}
if (!file_exists($path_file)) {
mkdirs($path_file);
}
$open = fopen($file_name, "a");
fwrite($open, serialize($array));
fclose($open);
} else {
return;
}
}
示例14: _thumb_media_id
function _thumb_media_id($cover_id)
{
$cover = get_cover($cover_id);
$driver = C('PICTURE_UPLOAD_DRIVER');
if ($driver != 'Local' && !file_exists(SITE_PATH . $cover['path'])) {
// 先把图片下载到本地
$pathinfo = pathinfo(SITE_PATH . $cover['path']);
mkdirs($pathinfo['dirname']);
$content = wp_file_get_contents($cover['url']);
$res = file_put_contents(SITE_PATH . $cover['path'], $content);
if ($res) {
return '';
}
}
$path = $cover['path'];
if (!$path) {
return '';
}
$param['type'] = 'thumb';
$param['media'] = '@' . realpath(SITE_PATH . $path);
$url = 'https://api.weixin.qq.com/cgi-bin/material/add_material?access_token=' . get_access_token();
$res = post_data($url, $param, true);
if (isset($res['errcode']) && $res['errcode'] != 0) {
return '';
}
$map['cover_id'] = $cover_id;
$map['manager_id'] = $this->mid;
$this->where($map)->setField('thumb_media_id', $res['media_id']);
return $res['media_id'];
}
示例15: imageThumb
/**
* 图像缩略处理
* 可处理图像类型jpg和png
* 如果原图像宽度小于指定宽度, 直接复制到目标地址
* 如果原图像宽度大于指定宽度, 按比例缩放至指定宽度后保存至目标地址
*
* @param string $srcfile 原图像地址
* @param string $desfile 新图像地址
* @param int|number $width 大于0
* @return bool true|error
*/
public static function imageThumb($srcfile, $desfile, $width = 600)
{
if (!file_exists($srcfile)) {
return error('-1', '原图像不存在');
}
if (intval($width) <= 0) {
return error('-1', '缩放宽度无效');
}
$des = dirname($desfile);
//创建存放目录
if (!file_exists($des)) {
if (!mkdirs($des)) {
return error('-1', '创建目录失败');
}
} elseif (!is_writable($des)) {
return error('-1', '目录无法写入');
}
//原图像信息
$org_info = @getimagesize($srcfile);
if ($width > $org_info[0]) {
copy($srcfile, $desfile);
return true;
}
if ($org_info) {
if ($org_info[2] == 1) {
//gif不处理
if (function_exists("imagecreatefromgif")) {
$img_org = imagecreatefromgif($srcfile);
}
} elseif ($org_info[2] == 2) {
if (function_exists("imagecreatefromjpeg")) {
$img_org = imagecreatefromjpeg($srcfile);
}
} elseif ($org_info[2] == 3) {
if (function_exists("imagecreatefrompng")) {
$img_org = imagecreatefrompng($srcfile);
}
}
} else {
return error('-1', '获取原始图像信息失败');
}
//源图像的宽高比
$scale_org = $org_info[0] / $org_info[1];
//缩放后的高
$height = $width / $scale_org;
if (function_exists("imagecreatetruecolor") && function_exists("imagecopyresampled") && @($img_dst = imagecreatetruecolor($width, $height))) {
imagecopyresampled($img_dst, $img_org, 0, 0, 0, 0, $width, $height, $org_info[0], $org_info[1]);
} else {
return error('-1', 'PHP环境不支持图片处理');
}
if (function_exists('imagejpeg')) {
imagejpeg($img_dst, $desfile);
} elseif (function_exists('imagepng')) {
imagepng($img_dst, $desfile);
}
imagedestroy($img_dst);
imagedestroy($img_org);
return true;
}