本文整理汇总了PHP中dir_path函数的典型用法代码示例。如果您正苦于以下问题:PHP dir_path函数的具体用法?PHP dir_path怎么用?PHP dir_path使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了dir_path函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getFile
private function getFile($lang)
{
$path = dir_path('resources');
$file_name = $lang;
$file_extension = '.php';
$file = $path . DIRECTORY_SEPARATOR . $file_name . $file_extension;
return $file;
}
示例2: run
public function run()
{
$faker = Faker::create();
$count = 50;
$ids = Estate::lists('estate_id');
$images = read_dir(dir_path('estates'));
$images = array_values(array_diff($images, ['alien.png']));
for ($i = 0; $i < $count; $i++) {
Image::create(['image' => $images[$i], 'estate_id' => $faker->randomElement($ids), 'preview' => $faker->boolean(30)]);
}
}
示例3: dir_list
function dir_list($path, $exts = '', $list = array())
{
$path = dir_path($path);
$files = glob($path . '*');
foreach ($files as $v) {
if (!$exts || preg_match("/\\.({$exts})/i", $v)) {
$list[] = retrieve($v);
if (is_dir($v)) {
$list = dir_list($v, $exts, $list);
}
}
}
return $list;
}
示例4: dftp
function dftp($ftphost, $ftpuser, $ftppass, $ftpport = 21, $root = '/', $pasv = 0, $ssl = 0)
{
if ($ssl && function_exists('ftp_ssl_connect')) {
$this->fp = @ftp_ssl_connect($ftphost, $ftpport);
} else {
if (function_exists('ftp_connect')) {
$this->fp = @ftp_connect($ftphost, $ftpport);
} else {
return false;
}
}
$this->connected = @ftp_login($this->fp, $ftpuser, $ftppass);
@ftp_pasv($this->fp, $pasv);
$this->root = dir_path($root);
}
示例5: ueditorImageManagerAction
/**
* ueditor在线图片管理
*
* @author mrmsl <msl-138@163.com>
* @date 2013-07-16 21:56:18
*
* @return void 无返回值
*/
public function ueditorImageManagerAction()
{
require CORE_PATH . 'functions/dir.php';
$file_arr = list_dir(UPLOAD_PATH);
$str = '';
if ($file_arr) {
rsort($file_arr, SORT_STRING);
foreach ($file_arr as $file) {
if (preg_match('/\\.(gif|jpeg|jpg|png|bmp)$/i', $file)) {
$str .= $file . 'ue_separate_ue';
}
}
}
exit(str_replace(dir_path(UPLOAD_PATH), '', $str));
}
示例6: pickLanguage
private function pickLanguage($lang)
{
$path = dir_path('resources');
$file_name = $lang;
$file_extension = '.php';
$file = $path . DIRECTORY_SEPARATOR . $file_name . $file_extension;
$current_texts = [];
if (File::exists($file)) {
include $file;
$page = (string) r();
$texts = $texts[$page];
$general_texts = $general;
$current_texts = array_merge($texts, $general_texts);
}
return $current_texts;
}
示例7: dir_create
/**
* 创建目录
*
* @param string $path 路径
* @param string $mode 属性
* @return string 如果已经存在则返回true,否则为flase
* @ 致远
*/
function dir_create($path, $mode = 0777)
{
if (is_dir($path)) {
return TRUE;
}
$ftp_enable = 0;
$path = dir_path($path);
$temp = explode('/', $path);
$cur_dir = '';
$max = count($temp) - 1;
for ($i = 0; $i < $max; $i++) {
$cur_dir .= $temp[$i] . '/';
if (@is_dir($cur_dir)) {
continue;
}
@mkdir($cur_dir, 0777, true);
@chmod($cur_dir, 0777);
}
return is_dir($path);
}
示例8: meta_file_path
function meta_file_path($type, $file_path)
{
$dir_name = 'meta';
$file_path = dir_path($file_path);
return $file_path . $dir_name . '/' . $type . '.txt';
}
示例9: delete_install
function delete_install($dir)
{
$dir = dir_path($dir);
if (!is_dir($dir)) {
return FALSE;
}
$list = glob($dir . '*');
foreach ($list as $v) {
is_dir($v) ? delete_install($v) : @unlink($v);
}
return @rmdir($dir);
}
示例10: dir_delete
function dir_delete($dir)
{
//ɾ������Ŀ¼,�谤��ɾ��Ŀ¼�µ�Ŀ¼���ļ�
$dir = dir_path($dir);
if (!is_dir($dir)) {
return false;
}
$list = glob($dir . '*');
//Ѱ����*ģʽƥ��������ļ�·��
if ($list) {
foreach ($list as $v) {
is_dir($v) ? dir_delete($v) : @unlink($v);
//ɾ�����ļ�
}
}
return @rmdir($dir);
}
示例11: touch_dir
/**
* 设置目录下面的所有文件的访问和修改时间
*
* @param string $path 路径
* @param int $mtime 修改时间
* @param int $atime 访问时间
*
* @return bool
*/
function touch_dir($path, $mtime = START_TIME, $atime = START_TIME)
{
$path = dir_path($path);
if (!is_dir($path)) {
return false;
}
!is_dir($path) && touch($path, $mtime, $atime);
$files = glob($path . '*');
foreach ($files as $v) {
is_dir($v) ? touch_dir($v, $mtime, $atime) : touch($v, $mtime, $atime);
}
return true;
}
示例12: dir_list
function dir_list($path, $exts = '', $list = array())
{
$path = dir_path($path);
$files = glob($path . '*');
foreach ($files as $v) {
if (!$exts || pathinfo($v, PATHINFO_EXTENSION) == $exts) {
$list[] = $v;
if (is_dir($v)) {
$list = dir_list($v, $exts, $list);
}
}
}
return $list;
}
示例13: __buildImage
function __buildImage($file_path)
{
$this->_progressStep('EncodeImage', 5, 'Encoding Image');
$ext = file_extension($file_path);
$parent_dir = dir_path($file_path);
$tmp_file = $file_path;
$orig_dimensions = get_file_info('dimensions', $file_path);
if (!$orig_dimensions) {
throw new RuntimeException('Could not read image: ' . $file_path);
}
$cmd = '';
$target_dimensions = scale_proud($orig_dimensions, $this->_options['EncoderDimensions']);
if ($target_dimensions) {
$cmd .= ' -size ' . $orig_dimensions;
$cmd .= ' -resize ' . $target_dimensions;
} else {
$target_dimensions = $this->_options['EncoderDimensions'];
}
$frame_path = frame_file_path($file_path, $this->_options['EncoderDimensions'], 1);
$file = $frame_path . '0.' . $this->_options['EncoderExtension'];
if (!safe_path($file)) {
throw new RuntimeException('Could not create path: ' . $file);
}
if ($cmd || $this->_options['EncoderExtension'] != substr($tmp_file, -strlen($this->_options['EncoderExtension']))) {
$cmd = $this->_options['PathCropper'] . $cmd . ' ' . $tmp_file;
$cmd .= ' -quality ' . $this->_options['EncoderImageQuality'];
$cmd .= ' -type TrueColor';
switch ($this->_options['EncoderExtension']) {
case 'ping':
case 'png':
case 'giff':
case 'gif':
$cmd .= 'Matte -depth 32';
}
$cmd .= ' ' . $file;
$shell_result = $this->_shellExecute($cmd);
if ($shell_result) {
throw new RuntimeException('Could not create image: ' . $shell_result);
}
} else {
copy($tmp_file, $file);
}
if (!file_exists($file)) {
throw new RuntimeException('Failed to create image: ' . $file . ' ' . $cmd);
}
$this->_progressStep('EncodeImage', 100, 'Encoded Image');
}
示例14: dir_delete
function dir_delete($dir)
{
$dir = dir_path($dir);
if (!is_dir($dir)) {
return false;
}
$dirs = array(DT_ROOT . '/admin/', DT_ROOT . '/api/', DT_CACHE . '/', DT_ROOT . '/file/', DT_ROOT . '/include/', DT_ROOT . '/lang/', DT_ROOT . '/member/', DT_ROOT . '/module/', DT_ROOT . '/skin/', DT_ROOT . '/template/', DT_ROOT . '/mobile/');
if (substr($dir, 0, 1) == '.' || in_array($dir, $dirs)) {
die("Cannot Remove System DIR {$dir} ");
}
$list = glob($dir . '*');
if ($list) {
foreach ($list as $v) {
is_dir($v) ? dir_delete($v) : @unlink($v);
}
}
return @rmdir($dir);
}
示例15: dir_delete
function dir_delete($dir)
{
$dir = dir_path($dir);
if (!is_dir($dir)) {
return false;
}
$list = glob($dir . '*');
foreach ($list as $file) {
is_dir($file) ? dir_delete($file) : unlink($file);
}
return rmdir($dir);
}