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


PHP Folder::inPath方法代码示例

本文整理汇总了PHP中Folder::inPath方法的典型用法代码示例。如果您正苦于以下问题:PHP Folder::inPath方法的具体用法?PHP Folder::inPath怎么用?PHP Folder::inPath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Folder的用法示例。


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

示例1: testInPath

 /**
  * testInPath method
  *
  * @access public
  * @return void
  */
 function testInPath()
 {
     $path = dirname(dirname(__FILE__));
     $inside = dirname($path) . DS;
     $Folder = new Folder($path);
     $result = $Folder->pwd();
     $this->assertEqual($result, $path);
     $result = Folder::isSlashTerm($inside);
     $this->assertTrue($result);
     $result = $Folder->realpath('tests/');
     $this->assertEqual($result, $path . DS . 'tests' . DS);
     $result = $Folder->inPath('tests' . DS);
     $this->assertTrue($result);
     $result = $Folder->inPath(DS . 'non-existing' . $inside);
     $this->assertFalse($result);
 }
开发者ID:robotarmy,项目名称:Phog,代码行数:22,代码来源:folder.test.php

示例2: testInPath

 /**
  * testInPath method
  *
  * @return void
  */
 public function testInPath()
 {
     $path = dirname(dirname(__FILE__));
     $inside = dirname($path) . DS;
     $Folder = new Folder($path);
     $result = $Folder->pwd();
     $this->assertEquals($path, $result);
     $result = Folder::isSlashTerm($inside);
     $this->assertTrue($result);
     $result = $Folder->realpath('Test/');
     $this->assertEquals($path . DS . 'Test' . DS, $result);
     $result = $Folder->inPath('Test' . DS);
     $this->assertTrue($result);
     $result = $Folder->inPath(DS . 'non-existing' . $inside);
     $this->assertFalse($result);
     $result = $Folder->inPath($path . DS . 'Model', true);
     $this->assertTrue($result);
 }
开发者ID:yuuicchan0912,项目名称:sample2,代码行数:23,代码来源:FolderTest.php

示例3: location

 /**
  * Checks if path is within given locations
  *
  * @param string $check Absolute path
  * @param mixed $allow True or * allows any location,
  * 	an array containing absolute paths to locations
  * @return boolean
  */
 function location($check, $allow = false)
 {
     $allow = self::_normalize($allow);
     if ($allow === true) {
         return true;
     } elseif ($allow === false) {
         return false;
     }
     if (!is_array($allow)) {
         $allow = array($allow);
     } else {
         $allow = array_unique($allow);
     }
     if (Validation::url($check)) {
         foreach ($allow as $path) {
             if (preg_match('/^' . preg_quote($path, '/') . '/', $check)) {
                 return true;
             }
         }
     } elseif (MediaValidation::file($check, false)) {
         $check = dirname($check);
         if (!Folder::isAbsolute($check)) {
             return false;
         }
         $Check = new Folder($check);
         foreach ($allow as $path) {
             if (!Folder::isAbsolute($path) || Validation::url($path)) {
                 continue;
             }
             if ($Check->inPath($path)) {
                 return true;
             }
         }
     }
     return false;
 }
开发者ID:rcaravita,项目名称:jodeljodel,代码行数:44,代码来源:media_validation.php

示例4: testInPathInvalidPathArgument

 /**
  * @dataProvider inPathInvalidPathArgumentDataProvider
  * @param string $path
  * @expectedException \InvalidArgumentException
  * @expectedExceptionMessage The $path argument is expected to be an absolute path.
  */
 public function testInPathInvalidPathArgument($path)
 {
     $Folder = new Folder();
     $Folder->inPath($path);
 }
开发者ID:hodrigohamalho,项目名称:cakephp-ex,代码行数:11,代码来源:FolderTest.php


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