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


PHP FSS_Helper::basename方法代碼示例

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


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

示例1: download

 function download()
 {
     $fileid = JRequest::getVar('fileid', 0, '', 'int');
     $db = JFactory::getDBO();
     $query = 'SELECT * FROM #__fss_kb_attach WHERE id = "' . FSSJ3Helper::getEscaped($db, $fileid) . '"';
     $db->setQuery($query);
     $row = $db->loadAssoc();
     $filename = FSS_Helper::basename($row['filename']);
     $file_extension = strtolower(substr(strrchr($filename, "."), 1));
     $ctype = FSS_Helper::datei_mime($file_extension);
     while (ob_get_level() > 0) {
         ob_end_clean();
     }
     header("Cache-Control: public, must-revalidate");
     header('Cache-Control: pre-check=0, post-check=0, max-age=0');
     header("Pragma: no-cache");
     header("Expires: 0");
     header("Content-Description: File Transfer");
     header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");
     header("Content-Type: " . $ctype);
     //header("Content-Length: ".(string)$row['size']);
     header('Content-Disposition: attachment; filename="' . $filename . '"');
     header("Content-Transfer-Encoding: binary\n");
     //echo getcwd(). "<br>";
     $file = "../components/com_fss/files/" . $row['diskfile'];
     //echo $file;
     @readfile($file);
     exit;
 }
開發者ID:vstorm83,項目名稱:propertease,代碼行數:29,代碼來源:kbart.php

示例2: downloadFile

 function downloadFile()
 {
     $fileid = FSS_Input::getInt('fileid');
     $db = JFactory::getDBO();
     $query = 'SELECT * FROM #__fss_kb_attach WHERE id = "' . FSSJ3Helper::getEscaped($db, $fileid) . '"';
     $db->setQuery($query);
     $row = $db->loadAssoc();
     $filename = FSS_Helper::basename($row['filename']);
     $file_extension = strtolower(substr(strrchr($filename, "."), 1));
     $ctype = FSS_Helper::datei_mime($file_extension);
     if (ob_get_level() > 0) {
         ob_end_clean();
     }
     $file = JPATH_SITE . DS . FSS_Settings::get('attach_location') . DS . 'kb' . DS . $row['diskfile'];
     if (!file_exists($file)) {
         $file = JPATH_SITE . DS . FSS_Settings::get('attach_location') . DS . $row['diskfile'];
     }
     if (!file_exists($file)) {
         echo "File not found - " . $row['diskfile'] . "<br />";
         echo "Paths Tested:<br />";
         echo "<ul>";
         echo "<li>" . JPATH_SITE . DS . FSS_Settings::get('attach_location') . DS . 'kb' . "</li>";
         echo "<li>" . JPATH_SITE . DS . FSS_Settings::get('attach_location') . "</li>";
         echo "</ul>";
         return;
     }
     header("Cache-Control: public, must-revalidate");
     header('Cache-Control: pre-check=0, post-check=0, max-age=0');
     header("Pragma: no-cache");
     header("Expires: 0");
     header("Content-Description: File Transfer");
     header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");
     header("Content-Type: " . $ctype);
     //header("Content-Length: ".(string)$row['size']);
     header('Content-Disposition: attachment; filename="' . $filename . '"');
     header("Content-Transfer-Encoding: binary\n");
     //echo getcwd(). "<br>";
     //echo $file;
     readfile($file);
     exit;
 }
開發者ID:vstorm83,項目名稱:propertease,代碼行數:41,代碼來源:view.html.php

示例3: attachDownload

 static function attachDownload($ticketid, $fileid, $for_user = false)
 {
     $ticket = new SupportTicket();
     if ($ticket->load($ticketid, $for_user)) {
         $attach = $ticket->getAttach($fileid);
         if (substr($attach->diskfile, 0, 7) == "http://" || substr($attach->diskfile, 0, 8) == "https://") {
             header('Location: ' . $attach->diskfile);
             exit;
         }
         $file = JPATH_SITE . DS . FSS_Settings::get('attach_location') . DS . "support" . DS . $attach->diskfile;
         $display_filename = FSS_Helper::basename($attach->filename);
         if (!$for_user) {
             $user = JFactory::GetUser($attach->user_id);
             $type = FSS_Settings::get('support_filename');
             switch ($type) {
                 case 1:
                     $display_filename = $user->username . "_" . $display_filename;
                     break;
                 case 2:
                     $display_filename = $user->username . "_" . date("Y-m-d") . "_" . $display_filename;
                     break;
                 case 3:
                     $display_filename = date("Y-m-d") . "_" . $user->username . "_" . $display_filename;
                     break;
                 case 4:
                     $display_filename = date("Y-m-d") . "_" . $display_filename;
                     break;
             }
         }
         require_once JPATH_SITE . DS . 'components' . DS . 'com_fss' . DS . 'helper' . DS . 'files.php';
         FSS_File_Helper::DownloadFile($file, $display_filename);
     }
     exit;
 }
開發者ID:vstorm83,項目名稱:propertease,代碼行數:34,代碼來源:support_helper.php


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