本文整理汇总了PHP中utils::mkdir_p方法的典型用法代码示例。如果您正苦于以下问题:PHP utils::mkdir_p方法的具体用法?PHP utils::mkdir_p怎么用?PHP utils::mkdir_p使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类utils
的用法示例。
在下文中一共展示了utils::mkdir_p方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
function __construct($prefix)
{
if (!is_dir(DATA_DIR . '/kvstore/')) {
utils::mkdir_p(DATA_DIR . '/kvstore/');
}
$this->rs = dba_popen(DATA_DIR . '/kvstore/dba.db', 'c');
}
示例2: _get_prev_pathname
private function _get_prev_pathname()
{
if (!is_dir(TMP_DIR)) {
utils::mkdir_p(TMP_DIR);
}
return TMP_DIR . '/' . $this->get_prev_key() . '.chdb';
}
示例3: __construct
function __construct()
{
$this->dir = ROOT_DIR . '/data/search/zend/lucene/';
if (!is_dir($this->dir)) {
utils::mkdir_p($this->dir, 0777, true);
}
}
示例4: save
function save($project)
{
if (!is_dir(DATA_DIR . '/projects')) {
utils::mkdir_p(DATA_DIR . '/projects');
}
file_put_contents(DATA_DIR . '/projects/' . $project['createtime'] . '.php', '<?php $project = ' . var_export($project, 1) . ';');
}
示例5: __construct
function __construct()
{
$workat = DATA_DIR . '/cache';
if (!is_dir($workat)) {
utils::mkdir_p($workat);
}
$this->workat($workat . '/filecache');
}
示例6: __construct
function __construct()
{
$workat = DATA_DIR . '/cache';
$this->secache_size = config::get('cache.base_cache_secache.size', '15M');
if (!is_dir($workat)) {
utils::mkdir_p($workat);
}
$this->workat($workat . '/secache');
}
示例7: __construct
function __construct()
{
$workat = DATA_DIR . '/cache';
if (!is_dir($workat)) {
utils::mkdir_p($workat);
}
$this->workat($workat . '/secache');
$this->check_vary_list();
}
示例8: export
function export($app_id, $path)
{
if (!file_exists(ROOT_DIR . "/app/{$app_id}/app.xml")) {
return;
}
utils::mkdir_p("{$path}/refs");
$this->update_index($app_id, $path);
$this->update_appinfo($app_id, $path);
$this->update_servicelib($app_id, $path);
$this->update_dbschema($app_id, $path);
}
示例9: post_install
public function post_install()
{
logger::info('Initial ectools');
kernel::single('base_initial', 'ectools')->init();
logger::info('Initial Regions');
kernel::single('ectools_regions_mainland')->install();
if (!is_dir(DATA_DIR . '/misc')) {
utils::mkdir_p(DATA_DIR . '/misc');
}
utils::cp(app::get('ectools')->res_dir . '/js/region_data.js', DATA_DIR . '/misc/region_data.js');
}
示例10: write_log
private function write_log($title = '', $class_name = 'b2c_api_callback_app', $request_method_name = 'rpc_request', $data = array())
{
if ($data) {
$log_file = DATA_DIR . '/logs/b2c/request/{date}/api_request.php';
$logfile = str_replace('{date}', date("Ymd"), $log_file);
//$logfile = DATA_DIR.'/logs/b2c/request/api_request.xml';
if (!file_exists($logfile)) {
if (!is_dir(dirname($logfile))) {
utils::mkdir_p(dirname($logfile));
}
$fs = fopen($logfile, 'w');
$str_xml = "<?php exit(0);";
$str_xml .= "'<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
$str_xml .= "<request>";
$str_xml .= "</request>';";
//error_log(print_r($str_xml,true),3,$logfile);
fwrite($fs, $str_xml);
fclose($fs);
}
$arr_data = array('method' => $data[0], 'params' => $data[1], 'rpc_callback' => $data[2]);
// 记录api日志
if (filesize($logfile)) {
$fs = fopen($logfile, 'a+');
$str_xml = fread($fs, filesize($logfile));
$str_xml = substr($str_xml, 0, strlen($str_xml) - 12);
fclose($fs);
}
$fs = fopen($logfile, 'w');
$str_xml .= "<query>";
$str_xml .= "<method>" . $arr_data['method'] . "</method>";
$str_xml .= "<params>" . print_r($arr_data['params'], true) . "</params>";
$str_xml .= "<rpc_callback>";
foreach ($arr_data['rpc_callback'] as $key => $value) {
$str_xml .= "<{$key}>" . $value . "</{$key}>";
}
$str_xml .= "</rpc_callback></query>";
$str_xml .= "</request>';";
fwrite($fs, $str_xml);
fclose($fs);
//error_log(print_r($str_xml,true),3,$logfile);
}
}
示例11: extra
static function extra($file, $dir)
{
$filename = $dir . '/' . $file['name'];
$dirname = dirname($filename);
if (!file_exists($dirname)) {
utils::mkdir_p($dirname);
}
if ($file['type'] == '0') {
fseek($file['rs'], $file['offset']);
$rs = fopen($filename, 'w');
$output = 0;
while ($output < $file['size']) {
$read = min($file['size'] - $output, 1024);
fputs($rs, fread($file['rs'], $read));
$output += $read;
}
fclose($rs);
touch($filename, $file['mtime']);
}
}
示例12: setting
function setting($pkey)
{
if (!$pkey) {
return false;
}
if ($_POST['setting']) {
$this->begin('javascript:finderGroup["' . $_POST['finder_id'] . '"].refresh();');
$payment = new $pkey($this->app);
$setting = $payment->setting();
foreach ($setting as $key => $setting_item) {
if ($setting_item['type'] == 'pecentage') {
$_POST['setting'][$key] = $_POST['setting'][$key] * 0.01;
}
}
$data['setting'] = $_POST['setting'];
$data['status'] = $_POST['status'];
$data['pay_type'] = $_POST['pay_type'];
$data['platform'] = $_POST['platform'];
//支付平台
// 是否有文件上传
if ($_FILES) {
$pos = strpos($pkey, '_');
$bankName = substr($pkey, $pos + 1);
$destination = DATA_DIR . '/cert/' . $bankName;
if (!file_exists($destination)) {
utils::mkdir_p($destination, 0755);
}
foreach ($_FILES['setting']['error'] as $evalue) {
if ($evalue == UPLOAD_ERR_OK) {
foreach ($_FILES['setting']['name'] as $nkey => $nvalue) {
$data['setting'][$nkey] = $nvalue;
foreach ($_FILES['setting']['tmp_name'] as $tkey => $tvalue) {
if (is_uploaded_file($tvalue)) {
if ($nkey == $tkey) {
$destination = DATA_DIR . '/cert/' . $bankName . '/' . $nvalue;
move_uploaded_file($tvalue, $destination);
}
}
}
}
}
}
}
$this->app->setConf($pkey, serialize($data));
$this->end(true, app::get('ectools')->_('支付方式修改成功!'));
} else {
$payment = new $pkey($this->app);
$setting = $payment->setting();
if ($setting) {
$val = $this->app->getConf($pkey);
$val = unserialize($val);
$render = $this->app->render();
$render->pagedata['admin_info'] = $payment->admin_intro();
$render->pagedata['settings'] = $setting;
foreach ($setting as $k => $v) {
$render->pagedata['settings'][$k]['value'] = $val['setting'][$k] ? $val['setting'][$k] : $val[$k];
if ($v['type'] == 'pecentage') {
$render->pagedata['settings'][$k]['value'] = $render->pagedata['settings'][$k]['value'] * 100;
}
if (strpos($v['type'], 'cur') !== false) {
// 得到所有的货币
$currency_mdl = $this->app->model('currency');
$arr_curs = $currency_mdl->getSysCur(false, '', false);
foreach ($arr_curs as &$str_currency) {
if (strpos($str_currency, ',') !== false) {
$str_currency = substr($str_currency, strpos($str_currency, ',') + 3);
}
}
if ($payment->supportCurrency) {
foreach ($payment->supportCurrency as $key => $str_support_cur) {
$render->pagedata['settings'][$k]['cur_value'] .= $arr_curs[$key];
}
}
}
}
$render->pagedata['classname'] = $pkey;
$render->display('payments/cfgs/cfgs.html');
} else {
echo '<div class="note">' . app::get("ectools")->_("不需要设置参数") . '</div>';
}
}
}
示例13: download
public function download($app_id, $force = false)
{
$download_able = $force;
if (!$download_able) {
$download_able = !file_exists(APP_DIR . '/' . $app_id . '/app.xml');
if (!$download_able) {
$rows = app::get('base')->model('apps')->getList('app_id,local_ver,remote_ver', array('app_id' => $app_id), 0, 1);
$download_able = $rows[0]['local_ver'] ? version_compare($rows[0]['remote_ver'], $rows[0]['local_ver'], '>') : true;
}
}
if ($download_able) {
$tmpfile = tempnam(TMP_DIR, 'app_');
$tmpdir = tempnam(TMP_DIR, 'app_');
$download_result = kernel::single('base_pget')->dl(sprintf(URL_APP_FETCH, $app_id), $tmpfile);
if (!$download_result) {
logger::info('Appliction [' . $app_id . '] download failed.');
exit;
}
$broken = false;
logger::info("\nExtra from package.");
foreach (base_package::walk($tmpfile) as $file) {
if (!$file) {
$broken = true;
break;
}
logger::info($file['name']);
base_package::extra($file, $tmpdir);
}
if (!$broken && file_exists($tmpdir . '/app.xml')) {
if (!is_dir(DATA_DIR . '/backup')) {
utils::mkdir_p(DATA_DIR . '/backup');
}
utils::cp(APP_DIR . '/' . $app_id, DATA_DIR . '/backup/app.' . $app_id . '.' . time());
utils::remove_p(APP_DIR . '/' . $app_id);
utils::cp($tmpdir, APP_DIR . '/' . $app_id);
utils::remove_p($tmpdir);
$this->update_local_app_info($app_id);
return true;
} else {
utils::remove_p($tmpdir);
return false;
}
}
}
示例14: check_dir
private function check_dir()
{
if (!is_dir(ROOT_DIR . '/data/kvstore/' . $this->prefix)) {
utils::mkdir_p(ROOT_DIR . '/data/kvstore/' . $this->prefix);
}
}
示例15: __construct
function __construct($prefix)
{
if (!is_dir(DATA_DIR . '/kvstore/')) {
utils::mkdir_p(DATA_DIR . '/kvstore/');
}
}