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

PHP file_path函数代码示例

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

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



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

示例1: getClassInstance

 /**
  * Метод получает экземпляр класса и, если нужно, кеширует его.
  */
 public static function getClassInstance($__DIR__, $subDir, $className, $parent, $caching = true)
 {
     if (!is_valid_file_name($className)) {
         return null;
         //---
     }
     $className = get_file_name($className);
     if ($className == $parent) {
         //Абстрактный класс/интерфейс лежит рядом с классами реализации - пропустим его
         return null;
     }
     //Абсолютный путь к классу
     $classPath = file_path(array($__DIR__, $subDir), $className, PsConst::EXT_PHP);
     //Ключ кеширования
     $cacheKey = md5($classPath);
     $CACHE = $caching ? SimpleDataCache::inst(__CLASS__, __FUNCTION__) : null;
     if ($CACHE && $CACHE->has($cacheKey)) {
         return $CACHE->get($cacheKey);
     }
     $INST = null;
     if (is_file($classPath)) {
         //Подключим данный класс
         require_once $classPath;
         //Проверим, существует ли класс
         $rc = PsUtil::newReflectionClass($className, false);
         $INST = $rc && $rc->isSubclassOf($parent) ? $rc->newInstance() : null;
     }
     if ($CACHE && $INST) {
         $CACHE->set($cacheKey, $INST);
     }
     return $INST;
 }
开发者ID:ilivanoff,项目名称:ps-sdk-dev,代码行数:35,代码来源:Classes.php


示例2: init

 /**
  * Метод вызывается для инициализации окружения:
  * 1. Директория ресурсов окружения будет подключена в Autoload
  * 2. Файл, включающий окружение, будет выполнен
  */
 public static function init()
 {
     if (self::$inited) {
         return;
         //---
     }
     self::$inited = true;
     //---
     /*
      * Проверим, нужно ли подключать окружение
      */
     if (self::isSkipInclude()) {
         return;
         //---
     }
     $env = self::env();
     if (!$env) {
         return;
         //---
     }
     $envDir = array_get_value($env, ConfigIni::environments());
     if (!$envDir) {
         return PsUtil::raise('Environment [{}] not found', $env);
     }
     if (!is_dir($envDir)) {
         return PsUtil::raise('Environment dir for [{}] not found', $env);
     }
     $envSrcDir = next_level_dir($envDir, DirManager::DIR_SRC);
     $envIncFile = file_path($envDir, $env, PsConst::EXT_PHP);
     if (!is_file($envIncFile)) {
         return PsUtil::raise('Environment include file for [{}] not found', $env);
     }
     $LOGGER = PsLogger::inst(__CLASS__);
     if ($LOGGER->isEnabled()) {
         $LOGGER->info('Including \'{}\' environment for context \'{}\'', $env, PsContext::describe());
         $LOGGER->info('Env dir:  {}', $envDir);
         $LOGGER->info('Src dir:  {}', $envSrcDir);
         $LOGGER->info('Inc file: {}', $envIncFile);
     }
     //Проинициализировано окружение
     self::$included = true;
     //Регистрируем директорию с классами, специфичными только для данного окружения
     Autoload::inst()->registerBaseDir($envSrcDir, false);
     //Выполним необходимое действие
     $PROFILER = PsProfiler::inst(__CLASS__);
     try {
         $LOGGER->info('{');
         $PROFILER->start($env);
         self::initImpl($LOGGER, $envIncFile);
         $secundomer = $PROFILER->stop();
         $LOGGER->info('}');
         $LOGGER->info('Inc file included for {} sec', $secundomer->getTime());
     } catch (Exception $ex) {
         $PROFILER->stop(false);
         $LOGGER->info('Inc file execution error: [{}]', $ex->getMessage());
         throw $ex;
         //---
     }
 }
开发者ID:ilivanoff,项目名称:ps-sdk-dev,代码行数:64,代码来源:PsEnvironment.php


示例3: partial

/**
 * Base helper, accessible in controllers, views and models
 *
 * @filesource
 * @copyright  Copyright (c) 2008-2014, Kamil "Brego" Dzieliński
 * @license    http://opensource.org/licenses/mit-license.php The MIT License
 * @author     Kamil "Brego" Dzieliński <[email protected]>
 * @link       http://prank.brego.dk/ Prank's project page
 * @package    Prank
 * @subpackage Helpers
 * @since      Prank 0.25
 * @version    Prank 0.75
 */
function partial($name, $params = [])
{
    $registry = Registry::instance();
    $controller = $registry->current_controller;
    extract($params);
    extract($controller->view_variables);
    require file_path($registry->config->views, $controller->get_controller(), '_' . $name . '.php');
}
开发者ID:brego,项目名称:prank,代码行数:21,代码来源:base.php


示例4: configure

function configure()
{
    option('app_dir', file_path(dirname(option('root_dir')), 'app'));
    option('lib_dir', file_path(option('app_dir'), 'lib'));
    option('views_dir', file_path(option('app_dir'), 'views'));
    option('session', "app_session");
    option('debug', false);
    setlocale(LC_TIME, "ro_RO");
}
开发者ID:stas,项目名称:student.utcluj.ro,代码行数:9,代码来源:bootstrap.php


示例5: dimpConsoleLog

function dimpConsoleLog()
{
    global $CALLED_FILE;
    if ($CALLED_FILE) {
        $log = file_path(dirname($CALLED_FILE), get_file_name($CALLED_FILE), 'log');
        $FULL_LOG = PsLogger::controller()->getFullLog();
        $FULL_LOG = mb_convert_encoding($FULL_LOG, 'UTF-8', 'cp866');
        file_put_contents($log, $FULL_LOG);
    }
}
开发者ID:ilivanoff,项目名称:www,代码行数:10,代码来源:MainImportProcess.php


示例6: test_file_path

function test_file_path()
{
    $p = "/one/two/three";
    assert_equal(file_path('/one', 'two', 'three'), $p);
    assert_equal(file_path('/one', '/two', 'three'), $p);
    assert_equal(file_path('/one', 'two', '///three'), $p);
    assert_equal(file_path('/one', 'two', 'three/'), $p . '/');
    assert_equal(file_path('/one', 'two', 'three//'), $p . '/');
    assert_equal(file_path('/one', '\\two', '\\three//'), $p . '/');
}
开发者ID:karupanerura,项目名称:isucon4,代码行数:10,代码来源:file.php


示例7: getHtml

 /**
  * Метод форматирует вывод Exception в html
  */
 public static function getHtml(Exception $exception)
 {
     //Вычитываем [exception.html] и производим замены
     try {
         return str_replace('{STACK}', ExceptionHelper::formatStackHtml($exception), file_get_contents(file_path(__DIR__, 'exception.html')));
     } catch (Exception $ex) {
         //Если в методе форматирования эксепшена ошибка - прекращаем выполнение.
         die("Exception [{$exception->getMessage()}] stack format error: [{$ex->getMessage()}]");
     }
 }
开发者ID:ilivanoff,项目名称:ps-sdk-dev,代码行数:13,代码来源:ExceptionHandler.php


示例8: before_render

 function before_render($content_or_func, $layout, $locals, $view_path)
 {
     if (is_callable($content_or_func)) {
     } elseif (file_exists($view_path) && !array_key_exists('content', $locals)) {
         // a view file but not a layout
         $view_path = file_path(option('views_dir'), basename($content_or_func, ".html.php") . "_filtered.html.php");
     } else {
         # it's a string
         $content_or_func .= "∞FILTERED∞";
     }
     return array($content_or_func, $layout, $locals, $view_path);
 }
开发者ID:jblanche,项目名称:limonade,代码行数:12,代码来源:output.php


示例9: render_filter_rewrite_short_tags

/**
 * a filter for rewriting views without short_open_tags
 *
 * @param string $view_path 
 * @return string $path to converted view file
 */
function render_filter_rewrite_short_tags($view_path)
{
    if (option('rewrite_short_tags') == true && (bool) @ini_get('short_open_tag') === false) {
        # cache path, maybe in tmp/cache/rsot_views/
        $cache_path = file_path(option('rewrite_sot_cache_dir'), $view_path);
        if (!file_exists($cache_path) || filemtime($cache_path) != filemtime($view_path)) {
            $view = file_get_contents($view_path);
            $transformed_view = preg_replace("/;*\\s*\\?>/", "; ?>", str_replace('<?=', '<?php echo ', $view));
            # TODO: store it in cache
            # …
        }
        $view_path = $cache_path;
    }
    return $view_path;
}
开发者ID:karupanerura,项目名称:isucon4,代码行数:21,代码来源:index.php


示例10: inst

 /** @return DirItem */
 public static function inst($path, $name = null, $ext = null)
 {
     $absPath = normalize_path(file_path($path, $name, $ext));
     if (!$absPath || DIR_SEPARATOR == $absPath || PATH_BASE_DIR == $absPath || PATH_BASE_DIR == $absPath . DIR_SEPARATOR) {
         $absPath = PATH_BASE_DIR;
     } else {
         if (!starts_with($absPath, PATH_BASE_DIR)) {
             $absPath = next_level_dir(PATH_BASE_DIR, $absPath);
         }
     }
     if (array_key_exists($absPath, self::$items)) {
         return self::$items[$absPath];
     }
     $relPath = cut_string_start($absPath, PATH_BASE_DIR);
     $relPath = ensure_dir_startswith_dir_separator($relPath);
     return self::$items[$absPath] = new DirItem($relPath, $absPath);
 }
开发者ID:ilivanoff,项目名称:ps-sdk-dev,代码行数:18,代码来源:DirItem.php


示例11: inst

 /** @return DirItem */
 public static function inst($path, $name = null, $ext = null)
 {
     $itemPath = normalize_path(file_path($path, $name, $ext));
     $corePath = normalize_path(PATH_BASE_DIR);
     //Обезопасим пути, в которых есть русские буквы
     try {
         $itemPath = iconv('UTF-8', 'cp1251', $itemPath);
     } catch (Exception $e) {
         //Если произойдёт ошибка - игнорируем
     }
     $isAbs = starts_with($itemPath, $corePath);
     $absPath = $isAbs ? $itemPath : next_level_dir($corePath, $itemPath);
     if (array_key_exists($absPath, self::$items)) {
         return self::$items[$absPath];
     }
     $relPath = cut_string_start($absPath, $corePath);
     $relPath = ensure_starts_with($relPath, DIR_SEPARATOR);
     return self::$items[$absPath] = new DirItem($relPath, $absPath);
 }
开发者ID:ilivanoff,项目名称:www,代码行数:20,代码来源:DirItem.php


示例12: index

 function index($id = null)
 {
     $data = $this->parent_account_model->getIdenticalColumn();
     debug($this->parent_account_model->db->last_query());
     if ($id == null) {
         $this->_set_flashdata('Invalid Feed reference key', 'error');
         redirect('home');
     }
     $id = trim($id);
     $activity_feed = $this->parent_account_model->getActivityFeedById($id);
     if (empty($activity_feed)) {
         $this->_set_flashdata('No activity feed found with the specified key', 'error');
         redirect('home');
     }
     $keywords = array();
     foreach (explode(' ', $activity_feed->description) as $keyword) {
         if (strlen($keyword) > 3) {
             $keywords[] = $keyword;
         }
     }
     $fb_app_id = $this->session->userdata('facebook_app_id');
     /*
      * OpenGraph Meta Settings
      */
     $this->data['title'] = $activity_feed->from . ' ' . $activity_feed->title;
     $this->data['description'] = $activity_feed->description;
     $this->data['keywords'] = implode(', ', $keywords);
     $this->data['author'] = 'Seedplane Development Team';
     $this->data['copyright'] = 'Seedplane';
     $this->data['app_name'] = 'seedplane';
     $this->data['social_type'] = 'article';
     $this->data['image'] = isset($activity_feed->image) && $activity_feed->image ? file_path('', $activity_feed->image, 'user_missing.png', 'uploads/default/') : '';
     $this->data['fb_app_id'] = isset($fb_app_id) && $fb_app_id ? $fb_app_id : '819064394807097';
     // end meta settings
     $this->data['activity_feed'] = $activity_feed;
     $this->ims_template->build('view_feed', $this->data);
 }
开发者ID:soarmorrow,项目名称:ci-kindergarden,代码行数:37,代码来源:view_feed.php


示例13: absFilePath

 public final function absFilePath($dirs, $fileName, $ext = null)
 {
     return file_path($this->absDirPath($dirs), $fileName, $ext);
 }
开发者ID:ilivanoff,项目名称:ps-sdk-dev,代码行数:4,代码来源:DirManager.php


示例14: dolog

<?php

require_once '../ToolsResources.php';
$CALLED_FILE = __FILE__;
dolog(__FILE__ . ' called in ' . time());
file_append_contents(file_path(__DIR__, 'called.log'), time() . "\n");
开发者ID:ilivanoff,项目名称:www,代码行数:6,代码来源:process.php


示例15: lang

                echo $activity_feed->activity_feed_id;
                ?>
"><?php 
                echo lang('share');
                ?>
</a></div>
                                <div class="innerWrapper">
                                    <input name="public_url" type="hidden" value="<?php 
                echo site_url('view_feed/index/' . $activity_feed->activity_feed_id);
                ?>
" />
                                    <?php 
                if ($activity_feed->image != '') {
                    ?>
                                        <div class="activity_image_div"><img src="<?php 
                    echo file_path("", $activity_feed->image, 'NoImageAvailable.jpg', 'uploads/default/');
                    ?>
"/></div>
                                    <?php 
                }
                ?>
                                    <div class="innerContent fli">
                                        <h3><?php 
                echo '<span class="activity_from">' . $activity_feed->from . '</span>' . '    ' . $activity_feed->title;
                ?>
</h3>
                                        <span class="timeLog"><?php 
                echo time_elapsed_string($activity_feed->date_time);
                ?>
</span>
                                        <?php 
开发者ID:soarmorrow,项目名称:ci-kindergarden,代码行数:31,代码来源:activity_feed.php


示例16: url_for

/**
 * Returns an url composed of params joined with /
 * A param can be a string or an array.
 * If param is an array, its members will be added at the end of the return url
 * as GET parameters "&key=value".
 *
 * @param string or array $param1, $param2 ... 
 * @return string
 */
function url_for($params = null)
{
    $paths = array();
    $params = func_get_args();
    $GET_params = array();
    foreach ($params as $param) {
        if (is_array($param)) {
            $GET_params = array_merge($GET_params, $param);
            continue;
        }
        if (filter_var_url($param)) {
            $paths[] = $param;
            continue;
        }
        $p = explode('/', $param);
        foreach ($p as $v) {
            if ($v != "") {
                $paths[] = str_replace('%23', '#', rawurlencode($v));
            }
        }
    }
    $path = rtrim(implode('/', $paths), '/');
    if (!filter_var_url($path)) {
        # it's a relative URL or an URL without a schema
        $base_uri = option('base_uri');
        $path = file_path($base_uri, $path);
    }
    if (!empty($GET_params)) {
        $is_first_qs_param = true;
        $path_as_no_question_mark = strpos($path, '?') === false;
        foreach ($GET_params as $k => $v) {
            $qs_separator = $is_first_qs_param && $path_as_no_question_mark ? '?' : '&amp;';
            $path .= $qs_separator . rawurlencode($k) . '=' . rawurlencode($v);
            $is_first_qs_param = false;
        }
    }
    if (DIRECTORY_SEPARATOR != '/') {
        $path = str_replace(DIRECTORY_SEPARATOR, '/', $path);
    }
    return $path;
}
开发者ID:soitun,项目名称:CRMx,代码行数:50,代码来源:limonade.php


示例17: lang

?>
"><?php 
echo lang('delete');
?>
</a></li>
                    
                   
                </ul>
            </div>      
            <div class="da-panel-content">
                <table class="da-table da-detail-view da-child-detail-head">
                    <tbody>
                        <tr class="dataTableHead">
                            <th>Logo</th>
                            <td class="logo_td"> <img src="<?php 
echo file_path('uploads/centre/', $data_all->logo, 'logo.gif');
?>
" height="26%;"></td>
                        </tr>
                    	<tr class="dataTableHead">
                        	<th>Centre Acronym</th>
                            <td><?php 
echo $data_all->name;
?>
</td>
                        </tr>
                        <tr class="dataTableHead">
                        	<th>Full Name</th>
                        	<td><?php 
echo $data_all->fullName;
?>
开发者ID:soarmorrow,项目名称:ci-kindergarden,代码行数:31,代码来源:view.php


示例18: process_image

/**
 *  Generates thumbnails and extracts information from 2-D image files
 *
 */
function process_image($db, $fileid, $bigsize)
{
    global $USER, $system_settings;
    if (!$bigsize) {
        $bigsize = 300;
    }
    if (!$fileid) {
        return false;
    }
    $imagefile = file_path($db, $fileid);
    if (!file_exists($imagefile)) {
        return false;
    }
    $bigthumb = $system_settings['thumbnaildir'] . "/big/{$fileid}.jpg";
    $smallthumb = $system_settings['thumbnaildir'] . "/small/{$fileid}.jpg";
    $smallsize = $system_settings['smallthumbsize'];
    $convert = $system_settings['convert'];
    // make big thumbnail and get image info
    if (extension_loaded('gd') || extension_loaded('gd2')) {
        //Get Image size info
        list($width_orig, $height_orig, $image_type) = getimagesize($imagefile);
        switch ($image_type) {
            case 1:
                $im = imagecreatefromgif($imagefile);
                break;
            case 2:
                $im = imagecreatefromjpeg($imagefile);
                break;
            case 3:
                $im = imagecreatefrompng($imagefile);
                break;
            default:
                break;
        }
        /*** calculate the aspect ratio ***/
        $aspect_ratio = (double) $height_orig / $width_orig;
        /*** calulate the thumbnail width based on the height ***/
        $thumb_height = round($bigsize * $aspect_ratio);
        $newImg = imagecreatetruecolor($bigsize, $thumb_height);
        imagecopyresampled($newImg, $im, 0, 0, 0, 0, $bigsize, $thumb_height, $width_orig, $height_orig);
        imagejpeg($newImg, $bigthumb);
    } else {
        $command = "{$convert} -verbose -sample " . $bigsize . "x" . $bigsize . " {$action} \"{$imagefile}\" jpg:{$bigthumb}";
        exec($command, $result_str_arr, $status);
    }
    // make small thumbnail
    if (extension_loaded('gd') || extension_loaded('gd2')) {
        //Get Image size info
        list($width_orig, $height_orig, $image_type) = getimagesize($imagefile);
        switch ($image_type) {
            case 1:
                $im = imagecreatefromgif($imagefile);
                break;
            case 2:
                $im = imagecreatefromjpeg($imagefile);
                break;
            case 3:
                $im = imagecreatefrompng($imagefile);
                break;
            default:
                break;
        }
        /*** calculate the aspect ratio ***/
        $aspect_ratio = (double) $height_orig / $width_orig;
        /*** calulate the thumbnail width based on the height ***/
        $thumb_height = round($smallsize * $aspect_ratio);
        $newImg = imagecreatetruecolor($smallsize, $thumb_height);
        imagecopyresampled($newImg, $im, 0, 0, 0, 0, $smallsize, $thumb_height, $width_orig, $height_orig);
        imagejpeg($newImg, $smallthumb);
    } else {
        $command = "{$convert} -sample " . $smallsize . "x" . $smallsize . " {$action} \"{$imagefile}\" jpg:{$smallthumb}";
        `{$command}`;
    }
    // get size, mime, and type from image file.
    // Try exif function, if that fails use convert
    $sizearray = getimagesize($imagefile);
    $width = $sizearray[0];
    if ($width) {
        $height = $sizearray[1];
        $mime = $sizearray['mime'];
        switch ($sizearray[2]) {
            case 1:
                $filename_extension = 'GIF';
                break;
            case 2:
                $filename_extension = 'JPG';
                break;
            case 3:
                $filename_extension = 'PNG';
                break;
            case 4:
                $filename_extension = 'SWF';
                break;
            case 5:
                $filename_extension = 'PSD';
                break;
//.........这里部分代码省略.........
开发者ID:nicost,项目名称:phplabware,代码行数:101,代码来源:db_inc.php


示例19: current_url

" ></div>
<div class="public_fb_buttons"><div class="fb-like" data-href="<?php 
echo current_url();
?>
" data-layout="button" data-action="like" data-show-faces="true" data-share="true"></div></div>
<div style="clear: both !important;"></div>
<div class="content_wraper">
    <div class="content_title"><h3><span> <?php 
echo isset($activity_feed->from) && $activity_feed->from ? $activity_feed->from : '';
?>
 </span><?php 
echo isset($activity_feed->title) && $activity_feed->title ? $activity_feed->title : '';
?>
</h3></div>
    <div class="content_wraper_img"><img src="<?php 
echo isset($activity_feed->image) && $activity_feed->image ? file_path('', $activity_feed->image, 'NoImageAvailable.jpg', 'uploads/default/') : '';
?>
"></div>

</div>
<div id="fb-root"></div>
<script>(function (d, s, id) {
        var js, fjs = d.getElementsByTagName(s)[0];
        if (d.getElementById(id))
            return;
        js = d.createElement(s);
        js.id = id;
        js.src = "//connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.3";
        fjs.parentNode.insertBefore(js, fjs);
    }(document, 'script', 'facebook-jssdk'));
        </script>
开发者ID:soarmorrow,项目名称:ci-kindergarden,代码行数:31,代码来源:view_feed.php


示例20: empty

        ?>
                        <li <?php 
        echo empty($teacher_name) ? 'height:100px' : '';
        ?>
">
                            <?php 
        $image = null;
        if (!empty($teacher_image)) {
            $hash = $teacher_image->avatar_hash;
            if (!empty($hash)) {
                $img = glob("uploads/avatar/*{$hash}.*", GLOB_BRACE);
                if (isset($img['0'])) {
                    $image = base_url($img['0']);
                }
            } else {
                $image = file_path("uploads/avatar/", $teacher_image->avatar, 'user_missing.png', 'uploads/default/');
            }
        } else {
            $image = base_url('uploads/default/user_missing.png');
        }
        ?>
 <br />
                            <div class="teacher_image">

                                <img src="<?php 
        echo $image;
        ?>
" alt="teacher_image">
                            </div>
                            <div class="teacher_comment">
                                <?php 
开发者ID:soarmorrow,项目名称:ci-kindergarden,代码行数:31,代码来源:view_progress_report.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP file_postupdate_standard_editor函数代码示例发布时间:2022-05-15
下一篇:
PHP file_partial函数代码示例发布时间: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