本文整理汇总了PHP中f::copy方法的典型用法代码示例。如果您正苦于以下问题:PHP f::copy方法的具体用法?PHP f::copy怎么用?PHP f::copy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类f
的用法示例。
在下文中一共展示了f::copy方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setUp
protected function setUp()
{
parent::setUp();
$this->user = $this->createAdmin();
$this->user->login('test');
$this->page = $this->site->children()->create('test', 'test');
f::copy($this->roots->dummy . DS . 'images' . DS . 'forrest.jpg', $this->page->root() . DS . '1.jpg');
f::copy($this->roots->dummy . DS . 'images' . DS . 'forrest.jpg', $this->page->root() . DS . '2.jpg');
}
示例2: copy
/**
* Copies the file to a new location
*
* @param string $to
* @return boolean
*/
public function copy($to)
{
return f::copy($this->root, $to);
}
示例3: testCopy
public function testCopy()
{
$this->assertTrue(f::copy(TEST_ROOT_TMP . DS . 'moved.txt', TEST_ROOT_TMP . DS . 'copied.txt'));
}
示例4: attach
public function attach($file, $filename = null)
{
// if the item has not been stored yet
// throw an exception
if (!$this->exists()) {
throw new Exception('Unstored item');
}
// filename fallback
if (is_null($filename)) {
$filename = basename($file);
}
// sanitize the filename
$filename = f::safeName($filename);
// the item.yaml cannot be overwritten
if ($filename == 'item.yaml') {
throw new Exception('item.yaml is a reserved filename');
}
// files cannot be overwritten
if (file_exists($this->root() . DS . $filename)) {
throw new Exception('The file exists and cannot be overwritten');
}
// attach a remote url
if (v::url($file)) {
$response = remote::get($file);
if ($response->code() < 400) {
if (!f::write($this->root() . DS . $filename, $response->content())) {
throw new Exception('The file could not be saved');
}
} else {
throw new Exception('The file could not be fetched');
}
} else {
if (file_exists($file)) {
if (!f::copy($file, $this->root() . DS . $filename)) {
throw new Exception('The file could not be copied');
}
}
}
}
示例5: copy
protected function copy()
{
// copy the controller template to the controller directory
f::copy($this->template(), $this->file());
}