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


PHP slashToBackslash函数代码示例

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


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

示例1: mkdir

 /**
  * create a new folder
  *
  * @path the path for the new folder
  * @mask
  * @dirOwner
  * @return boolean
  */
 function mkdir($path = null, $mask = null, $dirOwner = '')
 {
     $path = is_null($path) ? $this->filePath : $path;
     if (!file_exists($path)) {
         $mask = is_null($mask) ? $this->mask : $mask;
         $status = @mkdir(slashToBackslash($path));
         if ($mask) {
             @chmod(slashToBackslash($path), intval($mask, 8));
         }
         if ($dirOwner) {
             $this->chown(slashToBackslash($path), $dirOwner);
         }
         return $status;
     }
     return true;
 }
开发者ID:rip-projects,项目名称:judge,代码行数:24,代码来源:class.file.php

示例2: getRootPath

/**
 * get site root path
 *
 * @return String.
 */
function getRootPath() {
		$output = "";

		if (defined('CONFIG_WEBSITE_DOCUMENT_ROOT') && CONFIG_WEBSITE_DOCUMENT_ROOT)
		{

			return slashToBackslash(CONFIG_WEBSITE_DOCUMENT_ROOT);
		}
		if(isset($_SERVER['DOCUMENT_ROOT']) && ($output = relToAbs($_SERVER['DOCUMENT_ROOT'])) != '' )
		{

			return $output;
		}elseif(isset($_SERVER["SCRIPT_NAME"]) && isset($_SERVER["SCRIPT_FILENAME"]) && ($output = str_replace(backslashToSlash($_SERVER["SCRIPT_NAME"]), "", backslashToSlash($_SERVER["SCRIPT_FILENAME"]))) && is_dir($output))
		{

			return slashToBackslash($output);
		}elseif(isset($_SERVER["SCRIPT_NAME"]) && isset($_SERVER["PATH_TRANSLATED"]) && ($output = str_replace(backslashToSlash($_SERVER["SCRIPT_NAME"]), "", str_replace("//", "/", backslashToSlash($_SERVER["PATH_TRANSLATED"])))) && is_dir($output))
		{

			return $output;
		}else 
		{
			return '';
		}	

	return null;
}
开发者ID:hungnv0789,项目名称:vhtm,代码行数:32,代码来源:function.base.php

示例3: api_get_path

 * @since 22/April/2007
 *
 */
require_once '../../../../../../inc/global.inc.php';
require_once api_get_path(LIBRARY_PATH) . 'fckeditor/editor/plugins/ajaxfilemanager/inc/config.php';
$error = '';
$fileInfo = array();
if (CONFIG_SYS_VIEW_ONLY || !CONFIG_OPTIONS_RENAME) {
    $error = SYS_DISABLED;
} elseif (empty($_POST['name'])) {
    $error = ERR_RENAME_EMPTY;
} elseif (!preg_match("/^[a-zA-Z0-9 _\\-.]+\$/", $_POST['name'])) {
    $error = ERR_RENAME_FORMAT;
} elseif (empty($_POST['original_path']) || !file_exists($_POST['original_path'])) {
    $error = ERR_RENAME_FILE_NOT_EXISTS;
} elseif (substr(slashToBackslash(removeTrailingSlash($_POST['original_path'])), strrpos(slashToBackslash(removeTrailingSlash($_POST['original_path'])), "/") + 1) == $_POST['name']) {
    $error = ERR_NO_CHANGES_MADE;
} elseif (file_exists(addTrailingSlash(getParentPath($_POST['original_path'])) . $_POST['name'])) {
    $error = ERR_RENAME_EXISTS;
} elseif (is_file($_POST['original_path']) && !isValidExt($_POST['name'], explode(",", CONFIG_UPLOAD_VALID_EXTS), explode(",", CONFIG_UPLOAD_INVALID_EXTS))) {
    $error = ERR_RENAME_FILE_TYPE_NOT_PERMITED;
} elseif (!rename(removeTrailingSlash($_POST['original_path']), addTrailingSlash(getParentPath($_POST['original_path'])) . $_POST['name'])) {
    $error = ERR_RENAME_FAILED;
} else {
    //update record of session if image exists in session for cut or copy
    include_once CLASS_SESSION_ACTION;
    $sessionAction = new SessionAction();
    $selectedDocuments = $sessionAction->get();
    if (removeTrailingSlash($sessionAction->getFolder()) == getParentPath($_POST['original_path']) && sizeof($selectedDocuments)) {
        if (($key = array_search(basename($_POST['original_path']), $selectedDocuments)) !== false) {
            $selectedDocuments[$key] = $_POST['name'];
开发者ID:annickvdp,项目名称:Chamilo1.9.10,代码行数:31,代码来源:ajax_save_name.php


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