本文整理汇总了PHP中app\File::ls方法的典型用法代码示例。如果您正苦于以下问题:PHP File::ls方法的具体用法?PHP File::ls怎么用?PHP File::ls使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\File
的用法示例。
在下文中一共展示了File::ls方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: media
/**
* List of media files
*
* @param Request $request
* @param Response $response
* @return Response
*/
public function media(Request $request, Response $response)
{
$data = [];
$files = [];
$path = $this->settings['presentation']['media'];
$file = new File($path, '/', 'png|jpg|jpeg|bmp|gif|svg');
if ($_POST) {
$form = new Form($path);
$inpFile = $request->getUploadedFiles()['file'];
if ($form->uploadMedia($inpFile) === true) {
$data['flash'] = ['message' => 'Media uploaded successfully.', 'alert_type' => 'success'];
} else {
$data['flash'] = ['message' => 'Error! while uploading media.', 'alert_type' => 'danger'];
}
}
if ($file->ls() === false) {
$data['flash'] = ['message' => $file->getMessage(), 'alert_type' => 'danger'];
} else {
$files = $file->getFiles();
}
$data['files'] = $files;
$data['csrf_name'] = $request->getAttribute('csrf_name');
$data['csrf_value'] = $request->getAttribute('csrf_value');
$data['active_page'] = 'media';
return $this->view->render($response, 'admin/media.twig', $data);
}