當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。