本文整理汇总了PHP中File::files方法的典型用法代码示例。如果您正苦于以下问题:PHP File::files方法的具体用法?PHP File::files怎么用?PHP File::files使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类File
的用法示例。
在下文中一共展示了File::files方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getStoreBanner
function getStoreBanner($store_name)
{
$dir = 'assets/img/store/' . $store_name . '/banner';
if (!file_exists($dir)) {
mkdir($dir, 0777, true);
}
$listFiles = [];
$files = \File::files($dir);
foreach ($files as $path) {
$listFiles[] = pathinfo($path);
}
$count = 0;
foreach ($listFiles as $prodpath) {
if ($count == 0) {
$dirname = $prodpath['dirname'];
$basename = $prodpath['basename'];
}
$count++;
}
if ($count > 0) {
return $dirname . '/' . $basename;
} else {
return 'assets/img/nobanner.png';
}
}
示例2: it_does_not_cause_change_to_sql_directory
/** @test */
public function it_does_not_cause_change_to_sql_directory()
{
$pre_contents = \File::files(config('csvimport.sql_directory'));
$this->importer->import();
$post_contents = \File::files(config('csvimport.sql_directory'));
$this->assertEquals($pre_contents, $post_contents);
}
示例3: deal
/**
* 文件上传处理
*
* @param string $name
*
* @return bool
*/
protected static function deal($name = 'file')
{
// 判断文件是否上传
if (!isset($_FILES[$name])) {
self::$error = '上传文件不能为空!';
return false;
}
// 获取上传文件相关信息
self::$files = $_FILES[$name];
// 判断文件上传是否成功
if ($msg = self::getFailed()) {
self::$error = $msg;
return false;
}
// 判断上传文件类型是否合法
if (!self::isAllowType()) {
self::$error = '上传文件类型不允许!';
return false;
}
// 判断上传文件大小是否合法
if (!self::isAllowSize()) {
self::$error = '上传文件大小不允许!';
return false;
}
return true;
}
示例4: send
public function send(JustifFormRequest $request)
{
\Mail::send('emails.justificatif', array('username' => $request->get('username'), 'email' => $request->get('email'), 'justif' => $request->get('justificatif')), function ($message) use($request) {
$email = $request->email;
$username = $request->username;
$justif = $request->file('justificatif');
if ($justif->isValid()) {
$path = config('images.inscription');
$files = \File::files($path);
$newfile = $path . '/' . $username;
foreach ($files as $file) {
$fileWithoutExtension = substr($file, 0, -4);
if ($fileWithoutExtension === $newfile) {
\File::Delete($fileWithoutExtension . '.png');
\File::Delete($fileWithoutExtension . '.pdf');
\File::Delete($fileWithoutExtension . '.jpg');
}
}
$extension = $justif->getClientOriginalExtension();
$name = $username . '.' . $extension;
$justif->move($path, $name);
}
$file = $path . '/' . $name;
$message->attach($file);
$message->from($request->email);
$message->to('plateulere@gmail.com', 'Equipe Roadweb')->subject('envoi de justificatif');
$message->setReplyTo($email);
});
return \Redirect::route('compte')->with('message', 'Votre justificatif a bien été envoyé ! Vous serez informé de la validation de vos droits dans les 24 à 48h.');
}
示例5: bindRepositories
/**
*
*/
private function bindRepositories()
{
// Load config parameters needed.
$repositoriesBasePath = config('lararepo.path');
$baseNamespace = rtrim(config('lararepo.namespace'), '\\') . '\\';
$implementation = config('lararepo.implementation');
$skipRepositories = config('lararepo.skip');
$allRepos = \File::files($repositoriesBasePath);
foreach ($allRepos as $repo) {
$interface = basename($repo);
if (in_array($interface, $skipRepositories)) {
continue;
} else {
$interfaceName = str_replace('.php', '', $interface);
$commonName = str_replace('Interface', '', $interfaceName);
$interfaceFullClassName = $baseNamespace . $interfaceName;
$implementationFullClassName = $baseNamespace . $implementation . '\\' . $commonName;
if (class_exists($implementationFullClassName)) {
// Bind the class.
$this->app->bind($interfaceFullClassName, function ($app) use($implementationFullClassName) {
return $app->make($implementationFullClassName);
});
}
}
}
}
示例6: getModels
/**
* Get the model names from their filename.
*
* @return array
*/
protected function getModels()
{
$files = File::files(base_path() . '/app/models');
foreach ($files as $file) {
$models[] = pathinfo($file, PATHINFO_FILENAME);
}
return $models;
}
示例7: copyFiles
protected function copyFiles()
{
$files = \File::files(base_path());
foreach ($files as $file) {
$path = str_replace(base_path(), '', $file);
\File::copy($file, base_path() . '/backup/' . $this->timestamp . '/' . $path);
}
}
示例8: getAvailableTemplates
public function getAvailableTemplates()
{
$template = \CMS::getTemplatePath();
$files = \File::files('../app/views/templates/' . $template . '/pages');
foreach ($files as $index => $file) {
$files[$index] = str_replace('../app/views/templates/' . $template . '/', '', $file);
}
return $files;
}
示例9: getImages
/**
* @return array
*/
public function getImages($folder)
{
$base = config('gallery-settings.home_dir');
$path = trim($folder, '/');
$pathname = $base . $path;
$pictures = array_chunk(\File::files($pathname), 2);
foreach ($pictures as $chunk) {
$this->dispatch(new GenerateThumbnails($chunk));
}
}
示例10: seedOperators
private function seedOperators()
{
$sql_files = File::files($this->operatorsPath);
$index = 0;
foreach ($sql_files as $sql) {
$current[$index] = File::get($sql);
Queue::push('OperaterInsertQueue', $current[$index]);
unset($current[$index]);
$index++;
}
}
示例11: testConstruction
public function testConstruction()
{
$kirby = $this->kirbyInstance();
$site = $this->siteInstance($kirby);
$page = new Page($site, '1-a');
$files = new Files($page);
$file = new File($files, 'test.js');
$this->assertInstanceOf('Kirby', $file->kirby());
$this->assertEquals($kirby, $file->kirby());
$this->assertInstanceOf('Site', $file->site());
$this->assertEquals($site, $file->site());
$this->assertInstanceOf('Page', $file->page());
$this->assertEquals($page, $file->page());
$this->assertInstanceOf('Files', $file->files());
$this->assertEquals($files, $file->files());
$this->assertInstanceOf('Media', $file);
$this->assertEquals($page->root() . DS . 'test.js', $file->root());
$this->assertEquals($page->contentUrl() . '/test.js', $file->url());
$this->assertEquals($file->root(), (string) $file);
}
示例12: init
private function init()
{
$this->classes = [];
$dir = config('cms.path.data');
foreach (\File::files($dir) as $file) {
$basename = basename($file, '.php');
$className = '\\App\\CMS\\Data\\' . $basename;
$class = new $className();
$this->classes[$class->getAccessor()] = $class;
}
}
示例13: getKeys
public function getKeys($path, $langs)
{
$keys = [];
foreach ($langs as $lang) {
foreach (File::files($path . '/' . trim($lang, '/')) as $file) {
$translation = (require $file);
$keys = array_merge($keys, $this->extractKeys($translation, str_replace('.php', '', basename($file))));
}
}
return array_unique($keys);
}
示例14: checkLastBackupTime
/**
* Check last backup time
*
* Checks the modification time of files in authenticated user archive folder and if one of them is less than
* 5 minutes ago.
*
* @param User $user
*
* @return bool False if last backup was made less than 5 minutes ago, true otherwise
*/
public static function checkLastBackupTime(User $user)
{
$zipFiles = File::files(storage_path() . '/backups/' . $user->getId() . '/zip/');
foreach ($zipFiles as $zipFile) {
$timeOfBackup = File::lastModified($zipFile);
if ($timeOfBackup > strtotime('-5 minutes')) {
return false;
}
}
return true;
}
示例15: browseImage
public function browseImage(Request $request)
{
DB::table('test')->insert(['msg' => 'work fine']);
// $send = SendMail::all();
$test = $_GET['CKEditorFuncNum'];
$images = [];
$files = \File::files(public_path() . '/uploads/about');
foreach ($files as $file) {
$images[] = pathinfo($file);
}
return view('page.home', ['files' => $images, 'test' => $test]);
}