當前位置: 首頁>>代碼示例>>PHP>>正文


PHP UploadedFile::isFile方法代碼示例

本文整理匯總了PHP中Symfony\Component\HttpFoundation\File\UploadedFile::isFile方法的典型用法代碼示例。如果您正苦於以下問題:PHP UploadedFile::isFile方法的具體用法?PHP UploadedFile::isFile怎麽用?PHP UploadedFile::isFile使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Symfony\Component\HttpFoundation\File\UploadedFile的用法示例。


在下文中一共展示了UploadedFile::isFile方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: import

 /**
  * Import match plan from text file
  * @param Tournament $tournament Import related to tournament
  * @param String $date Date of match
  * @param String $importStr Match plan - must follow this syntax:
  *                          - Match no
  *                          - Match date (local format - j-m-Y)
  *                          - Match time (local format - G.i)
  *                          - Category name
  *                          - Group name
  *                          - Playground no
  *                          - Home team
  *                                  team name 'division' (country)
  *                                  rank group name
  *                          - Away team
  *                                  team name 'division' (country)
  *                                  rank group name
  *
  * Examples:    385;10-7-2015;13.00;C;(A);7;1 A;2 B
  *              212;5-7-2015;9.15;C;A;7;AETNA MASCALUCIA (ITA);TVIS KFUM 'A' (DNK)
  *
  * Country is only used if team name is ambigious - however syntax must be maintained.
  * Division can be ommitted.
  */
 public function import(UploadedFile $uploadedFile)
 {
     $keys = array("matchno", "date", "time", "category", "group", "playground", "teamA", "teamB");
     $matches = array();
     if ($uploadedFile->isValid() && $uploadedFile->isFile()) {
         /* @var $file SplFileObject */
         $file = $uploadedFile->openFile();
         while (!$file->eof()) {
             $csv = $file->fgetcsv(";");
             $match = array();
             foreach ($csv as $idx => $data) {
                 if ($data) {
                     if (array_key_exists($idx, $keys)) {
                         if ($keys[$idx] == 'teamA' || $keys[$idx] == 'teamB') {
                             $match[$keys[$idx]] = $this->parseImportTeam($data);
                         } else {
                             $match[$keys[$idx]] = $data;
                         }
                     } else {
                         $match[] = $data;
                     }
                 }
             }
             if (count($match) > 0) {
                 $matches[] = $match;
             }
         }
     }
     return $matches;
 }
開發者ID:armandomeeuwenoord,項目名稱:icup,代碼行數:54,代碼來源:MatchPlanningController.php


注:本文中的Symfony\Component\HttpFoundation\File\UploadedFile::isFile方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。