本文整理汇总了PHP中Cake\Filesystem\Folder::isSlashTerm方法的典型用法代码示例。如果您正苦于以下问题:PHP Folder::isSlashTerm方法的具体用法?PHP Folder::isSlashTerm怎么用?PHP Folder::isSlashTerm使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cake\Filesystem\Folder
的用法示例。
在下文中一共展示了Folder::isSlashTerm方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testIsSlashTerm
/**
* testIsSlashTerm method
*
* @return void
*/
public function testIsSlashTerm()
{
$this->assertFalse(Folder::isSlashTerm('cake'));
$this->assertTrue(Folder::isSlashTerm('C:\\cake\\'));
$this->assertTrue(Folder::isSlashTerm('/usr/local/'));
}
示例2: slashTerm
/**
* Returns $path with added terminating slash (corrected for Windows or other OS).
*
* @param string $path Path to check
* @return string Path with ending slash
*/
public static function slashTerm($path)
{
if (Folder::isSlashTerm($path)) {
return $path;
}
return $path . Folder::correctSlashFor($path);
}
示例3: save
/**
* Saves the file.
*
* If you specify only a directory as target, it will keep the original
* filename of the file.
* @param string $target Target
* @return mixed Target path or `false` on failure
* @uses _findTargetFilename()
* @uses _setError()
* @uses error()
* @uses $file
*/
public function save($target)
{
if (empty($this->file)) {
throw new InternalErrorException(__d('me_tools', 'There are no uploaded file information'));
}
//Checks for previous errors
if ($this->error()) {
return false;
}
//If the target is a directory, then adds the filename
if (is_dir($target)) {
//Adds slash term
if (!Folder::isSlashTerm($target)) {
$target .= DS;
}
$target .= $this->file->name;
}
$target = $this->_findTargetFilename($target);
if (!move_uploaded_file($this->file->tmp_name, $target)) {
$this->_setError(__d('me_tools', 'The file was not successfully moved to the target directory'));
return false;
}
return $target;
}