Tür Tanımlayıcı


    × Bunları biliyor muydunuz?
"Şablon sihirbazında (Wizard) (5.5.60) sürümünden beri döngülerin sonunda kullanılan : sembolünün kullanım zorunluluğu kaldırılmıştır."


Bu kütüphane dosyaların türleri hakkında bilgi verir.

 

 

# Kurulum


ZN SE ve ZN CE dağıtımları için terminal kurulum komutu.

↓ composer require znframework/package-helpers

 

 

# Yöntemler


Mixed __call()
String type(String $file)

 

 

# __Call (ZN >= 5.2.0)


Uzantıya göre dosyanın mime değerini verir. Dosya türü öğrenilmek istenen dosya uzantısı yöntem adı olarak kullanılır.

Parametreler

Void
Return Mixed

Kullanımlar

output( Mime::avi() );
0 => string 'video/x-msvideo' ( length = 17 )
1 => string 'video/msvideo' ( length = 15 )
2 => string 'video/avi' ( length = 11 )
3 => string 'application/x-troff-msvideo' ( length = 29 )
echo Mime::aac();
audio/x-acc

 

 

# Type (ZN >= 5.4.1)


Dosyanın mime türünü verir.

Parametreler

String $file Dosya yolu.
Return String

Kullanımlar

echo Mime::type('images/example.png');
image/png

 

 

# Tanımlı Tür Listesi


Listeyi genişletmek için aşağıdaki dosyada yer alan mimeTypes dizisinden istifade edebilirsiniz.

Dosya: Settings/Expressions.php
String $acc 'audio/x-acc'
String $ac3 'audio/ac3'
Array $ai 'application/pdf'
'application/postscript'
String $aifc 'audio/x-aiff'
Array $aif 'audio/x-aiff'
'audio/aiff'
Array $aiff 'audio/x-aiff'
'audio/aiff'
String $au 'audio/x-au'
Array $avi 'video/x-msvideo'
'video/msvideo'
'video/avi'
'application/x-troff-msvideo'
Array $bin 'application/macbinary'
'application/mac-binary'
'application/octet-stream'
'application/x-binary'
'application/x-macbinary'
Array $bmp 'image/bmp'
'image/x-bmp'
'image/x-bitmap'
'image/x-xbitmap'
'image/x-win-bitmap'
'image/x-windows-bmp'
'image/ms-bmp'
'image/x-ms-bmp'
'application/bmp'
'application/x-bmp'
'application/x-win-bitmap'
Array $cdr 'application/cdr'
'application/coreldraw'
'application/x-cdr'
'application/x-coreldraw'
'image/cdr'
'image/x-cdr'
'zz-application/zz-winassoc-cdr'
Array $cer 'application/pkix-cert'
'application/x-x509-ca-cert'
String $class 'application/octet-stream'
String $cpt 'application/mac-compactpro'
Array $crl 'application/pkix-crl'
'application/pkcs-crl'
Array $crt 'application/x-x509-ca-cert'
'application/x-x509-user-cert'
'application/pkix-cert'
String $csr 'application/octet-stream'
Array $css 'text/css'
'text/plain'
Array $csv 'text/x-comma-separated-values'
'text/comma-separated-values'
'application/octet-stream'
'application/vnd.ms-excel'
'application/x-csv'
'text/x-csv'
'text/csv'
'application/csv'
'application/excel'
'application/vnd.msexcel'
'text/plain'
String $dcr 'application/x-director'
String $der 'application/x-x509-ca-cert'
String $dir 'application/x-director'
String $dll 'application/octet-stream'
String $dms 'application/octet-stream'
Array $doc 'application/msword'
'application/vnd.ms-office'
Array $docx 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'
'application/zip'
'application/msword'
'application/x-zip'
Array $dot 'application/msword'
'application/vnd.ms-office'
Array $dotx 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'
'application/zip'
'application/msword'
String $dvi 'application/x-dvi'
String $dxr 'application/x-director'
String $eml 'message/rfc822'
String $eps 'application/postscript'
Array $exe 'application/octet-stream'
'application/x-msdownload'
String $flac 'audio/x-flac'
String $f4v 'video/mp4'
String $gif 'image/gif'
String $gpg 'application/gpg-keys'
String $gtar 'application/x-gtar'
String $gz 'application/x-gzip'
String $gzip 'application/x-gzip'
Array $hqx 'application/mac-binhex40'
'application/mac-binhex'
'application/x-binhex40'
'application/x-mac-binhex40'
Array $htm 'text/html'
'text/plain'
Array $html 'text/html'
'text/plain'
String $ical 'text/calendar'
String $ico 'image/x-icon'
String $ics 'text/calendar'
Array $jar 'application/java-archive'
'application/x-java-application'
'application/x-jar'
'application/x-compressed'
Array $jpeg 'image/jpeg' 'image/pjpeg'
Array $jpg 'image/jpeg' 'image/pjpeg'
Array $js 'application/x-javascript'
'text/plain'
Array $json 'application/json'
'text/json'
String $lha 'application/octet-stream'
Array $log 'text/plain' 'text/x-log'
String $lzh 'application/octet-stream'
String $kdb 'application/octet-stream'
Array $kml 'application/vnd.google-earth.kml+xml'
'application/xml'
'text/xml'
Array $kmz 'application/vnd.google-earth.kmz'
'application/zip'
'application/x-zip'
String $mid 'audio/midi'
String $midi 'audio/midi'
String $mif 'application/vnd.mif'
String $mov 'video/quicktime'
String $movie 'video/x-sgi-movie'
String $mpeg 'video/mpeg'
String $mpg 'video/mpeg'
String $mpga 'video/mpeg'
String $mp2 'video/mpeg'
Array $mp3 'audio/mpeg'
'audio/mpg'
'audio/mpeg3'
'audio/mp3'
String $mp4 'video/mp4'
String $m3u 'text/plain'
String $m4a 'audio/x-m4a'
String $m4u 'application/vnd.mpegurl'
String $oda 'application/oda'
String $ogg 'audio/ogg'
Array $pdf 'application/pdf'
'application/force-download'
'application/x-download'
'binary/octet-stream'
Array $pem 'application/x-x509-user-cert'
'application/x-pem-file'
'application/octet-stream'
String $pgp 'application/pgp'
Array $php 'application/x-httpd-php'
'application/php'
'application/x-php'
'text/php'
'text/x-php'
'application/x-httpd-php-source'
String $php5 'application/x-httpd-php-source'
String $phtml 'application/x-httpd-php'
Array $png 'image/png'
'image/x-png'
Array $ppt 'application/powerpoint'
'application/vnd.ms-powerpoint'
'application/vnd.ms-office'
'application/msword'
Array $pptx 'application/vnd.openxmlformats-officedocument.presentationml.presentation'
'application/x-zip'
'application/zip'
String $ps 'application/postscript'
Array $psd 'application/x-photoshop'
'image/vnd.adobe.photoshop'
Array $p10 'application/x-pkcs10'
'application/pkcs10'
String $p12 'application/x-pkcs12'
String $p7a 'application/x-pkcs7-signature'
Array $p7c 'application/pkcs7-mime'
'application/x-pkcs7-mime'
Array $p7m 'application/pkcs7-mime'
'application/x-pkcs7-mime'
String $p7r 'application/x-pkcs7-certreqresp'
String $p7s 'application/pkcs7-signature'
String $qt 'video/quicktime'
String $ra 'audio/x-realaudio'
String $ram 'audio/x-pn-realaudio'
Array $rar 'application/x-rar'
'application/rar'
'application/x-rar-compressed'
String $rm 'audio/x-pn-realaudio'
String $rpm 'audio/x-pn-realaudio-plugin'
String $rsa 'application/x-pkcs7'
String $rtf 'text/rtf'
String $rtx 'text/richtext'
String $rv 'video/vnd.rn-realvideo'
String $sea 'application/octet-stream'
Array $shtml 'text/html'
'text/plain'
String $sit 'application/x-stuffit'
String $smi 'application/smil'
String $smil 'application/smil'
String $so 'application/octet-stream'
Array $srt 'text/srt'
'text/plain'
String $sst 'application/octet-stream'
Array $svg 'image/svg+xml'
'application/xml'
'text/xml'
String $swf 'application/x-shockwave-flash'
String $tar 'application/x-tar'
String $text 'text/plain'
Array $tgz 'application/x-tar'
'application/x-gzip-compressed'
String $tif 'image/tiff'
String $tiff 'image/tiff'
String $txt 'text/plain'
String $vcf 'text/x-vcard'
String $vlc 'application/videolan'
Array $vtt 'text/vtt'
'text/plain'
Array $wav 'audio/x-wav'
'audio/wave'
'audio/wav'
String $wbxml 'application/wbxml'
String $webm 'video/webm'
Array $wma 'audio/x-ms-wma'
'video/x-ms-asf'
String $wmlc 'application/wmlc'
Array $wmv 'video/x-ms-wmv'
'video/x-ms-asf'
Array $word 'application/msword'
'application/octet-stream'
String $xht 'application/xhtml+xml'
String $xhtml 'application/xhtml+xml'
String $xl 'application/excel'
Array $xls 'application/vnd.ms-excel'
'application/msexcel'
'application/x-msexcel'
'application/x-ms-excel'
'application/x-excel'
'application/x-dos_ms_excel'
'application/xls'
'application/x-xls'
'application/excel'
'application/download'
'application/vnd.ms-office'
'application/msword'
Array $xlsx 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
'application/zip'
'application/vnd.ms-excel'
'application/msword'
'application/x-zip'
Array $xml 'application/xml'
'text/xml'
'text/plain'
Array $xsl 'application/xml'
'text/xsl'
'text/xml'
String $xspf 'application/xspf+xml'
String $z 'application/x-compress'
Array $zip 'application/x-zip'
'application/zip'
'application/x-zip-compressed'
'application/s-compressed'
'multipart/x-zip'
String $zsh 'text/x-scriptzsh'
Array $3gp 'video/3gp'
'video/3gpp'
String $3g2 'video/3gpp2'
Array $7zip 'application/x-compressed'
'application/x-zip-compressed'
'application/zip'
'multipart/x-zip'