当前位置: 首页>>代码示例>>PHP>>正文


PHP abspath函数代码示例

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


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

示例1: load_element

function load_element($name)
{
    global $elements, $prefs;
    if (empty($elements[$name])) {
        return false;
    }
    if (!empty($elements[$name]['loaded'])) {
        return true;
    }
    extract($elements[$name]);
    $dir = abspath(elements_dir);
    $file = secpath($name . '.php', $dir);
    if ($file == false) {
        trigger_error("path for element '{$name}' is invalid ({$dir})", E_USER_ERROR);
    }
    if (!is_file($file) or !is_readable($file)) {
        trigger_error("{$file} is inaccessible", E_USER_ERROR);
    }
    $style = secpath($name . '.css', $dir);
    if (is_file($style) && is_readable($style)) {
        $elements[$name]['stylesheet'] = elements_dir . '/' . $name . '.css';
    }
    $elements[$name]['loaded'] = 1;
    return include_once $file;
}
开发者ID:bgarrels,项目名称:textpattern,代码行数:25,代码来源:txplib_element.php

示例2: getScanDir

 public function getScanDir($resolve = true)
 {
     $scandir = $this->getParam("CSV:basedir", "var/import");
     if (!isabspath($scandir)) {
         $scandir = abspath($scandir, Magmi_Config::getInstance()->getMagentoDir(), $resolve);
     }
     return $scandir;
 }
开发者ID:marcellsauer,项目名称:magmi-git,代码行数:8,代码来源:magmi_csvdatasource.php

示例3: write

 public function write(Page $page)
 {
     $file = abspath('app/pages.php');
     $buffer = "<?php\n";
     $buffer .= "/** This file has been generated automatically by Builder interface */\n";
     $buffer .= '$metadata = ' . var_export($data, true) . ";\n";
     $buffer .= "?>";
     $ok = file_put_contents($file, $buffer);
     return $ok;
 }
开发者ID:moiseh,项目名称:metapages,代码行数:10,代码来源:PageStorage.php

示例4: checkDbTables

 public static function checkDbTables()
 {
     // database tables installer
     if (!\Meta\Db::tableExists('db_migrations')) {
         // import the whole initial databse file
         \Meta\Db::execute(file_get_contents(abspath('sql/database.sql')));
         Flash::success(t('Database imported.'));
         redirect(page_home());
     }
 }
开发者ID:moiseh,项目名称:codegen,代码行数:10,代码来源:Installer.php

示例5: pageFile

 public static function pageFile()
 {
     return abspath('app/pages.php');
 }
开发者ID:moiseh,项目名称:metapages,代码行数:4,代码来源:Builder.php

示例6: checkvalue

checkvalue($ac['CHMENABLED']);
checking("for PHP executable");
if ($ac['PHP'] == '' || $ac['PHP'] == 'no') {
    $ac['PHP'] = find_file($php_bin_names);
} else {
    if (file_exists($cygwin_php_bat)) {
        $ac['PHP'] = $cygwin_php_bat;
    }
}
if ($ac['PHP'] == '') {
    checkerror("Could not find a PHP executable. Use --with-php=/path/to/php.");
}
if (!file_exists($ac['PHP']) || !is_executable($ac['PHP'])) {
    checkerror("PHP executable is invalid - how are you running configure? " . "Use --with-php=/path/to/php.");
}
$ac['PHP'] = abspath($ac['PHP']);
checkvalue($ac['PHP']);
checking("for language to build");
if ($ac['LANG'] == '') {
    checkerror("Using '--with-lang=' or '--without-lang' is just going to cause trouble.");
} else {
    if ($ac['LANG'] == 'yes') {
        $ac['LANG'] = 'en';
    }
}
if ($ac["LANG"] == "en") {
    $ac["TRANSLATION_ONLY_INCL_BEGIN"] = "<!--";
    $ac["TRANSLATION_ONLY_INCL_END"] = "-->";
}
checkvalue($ac['LANG']);
checking("whether the language is supported");
开发者ID:guoyu07,项目名称:NYAF,代码行数:31,代码来源:configure.php

示例7: findImageFile

 public function findImageFile($ivalue)
 {
     // do no try to find remote image
     if (is_remote_path($ivalue)) {
         return $ivalue;
     }
     // if existing, return it directly
     if (realpath($ivalue)) {
         return $ivalue;
     }
     // ok , so it's a relative path
     $imgfile = false;
     $scandirs = explode(";", $this->getParam("IMG:sourcedir"));
     $cscandirs = count($scandirs);
     // iterate on image sourcedirs, trying to resolve file name based on input value and current source dir
     for ($i = 0; $i < $cscandirs && $imgfile === false; $i++) {
         $sd = $scandirs[$i];
         // scandir is relative, use mdh
         if ($sd[0] != "/") {
             $sd = $this->_mdh->getMagentoDir() . "/" . $sd;
         }
         $imgfile = abspath($ivalue, $sd, true);
     }
     return $imgfile;
 }
开发者ID:xiaoguizhidao,项目名称:ortodon,代码行数:25,代码来源:imageitattributeemprocessor.php

示例8: secpath

function secpath($path, $pfx = txpath)
{
    // similar to abspath, but the result must reside within $pfx
    $abs = abspath($path, $pfx);
    $p = realpath($pfx);
    if (substr($abs, 0, strlen($p)) == $p) {
        return $abs;
    }
    return false;
}
开发者ID:bgarrels,项目名称:textpattern,代码行数:10,代码来源:txplib_misc.php

示例9: getFilesPath

 public static function getFilesPath()
 {
     return abspath('files/');
 }
开发者ID:moiseh,项目名称:metapages,代码行数:4,代码来源:FileSystem.php

示例10: render

function render($template, $vars = array())
{
    $file = abspath('views/' . $template);
    if (!file_exists($file)) {
        throw new \Exception('Template not found: ' . basename($file));
    }
    extract($vars);
    ob_start();
    include $file;
    return ob_get_clean();
}
开发者ID:moiseh,项目名称:codegen,代码行数:11,代码来源:core.php

示例11: checkErrors

 public function checkErrors()
 {
     // check template
     if ($this->templateFile) {
         $file = abspath('views/' . $this->templateFile);
         if (!file_exists($file)) {
             throw new \Exception(t("The template '{$this->templateFile}' not found."));
         }
     }
     // sql query errors
     if ($this->query) {
         $error = \Meta\Builder::sqlError($this->query);
         if ($error) {
             throw new \Exception($error);
         }
     }
     parent::checkErrors();
 }
开发者ID:moiseh,项目名称:metapages,代码行数:18,代码来源:View.php

示例12: trim

    //  /a/b/12/34
    $a = trim($a, "/");
    //   a/b/c/d
    $b = trim($b, "/");
    //   a/b/12/34
    $a = explode("/", $a);
    //  array("a", "b", "c", "d")
    $b = explode("/", $b);
    //  array("a", "b", "12", "34")
    //合并上面代码相当于 $a = explode("/", trim(dirname($a), "/"));
    $num = max(count($a), count($b));
    for ($i = 0; $i < $num; $i++) {
        if ($a[$i] == $b[$i]) {
            unset($a[$i]);
            unset($b[$i]);
        } else {
            break;
        }
    }
    //$a = array("c", "d");
    //$b = array("12", "34");
    //第二步:回到同级目录, 进入另一个目录
    $path = str_repeat("../", count($b)) . implode("/", $a);
    //  ../../c/d
    return $path;
}
$a = "/a/b/c/d/e/w/f/e.php";
$b = "/a/b/12/34/100/c.php";
// ../../c/d
echo abspath($a, $b);
开发者ID:EdenChan,项目名称:Instances,代码行数:30,代码来源:abspath.php


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