PHP Class Magic
This method is slower than determining the type by file suffix but on the
other hand reduces the risk of fail positives during the test.
The magic file consists of ASCII characters defining the magic numbers for
different file types. Each row has 4 to 5 columns, empty and commented lines
(those starting with a hash character) are ignored. Columns are described
below.
o
1 -- byte number to begin checking from. ">" indicates a dependency
upon the previous non-">" line
o
2 -- type of data to match. Can be one of following
-
byte (single character)
-
short (machine-order 16-bit integer)
-
long (machine-order 32-bit integer)
-
string (arbitrary-length string)
-
date (long integer date (seconds since Unix epoch/1970))
-
beshort (big-endian 16-bit integer)
-
belong (big-endian 32-bit integer)
-
bedate (big-endian 32-bit integer date)
-
leshort (little-endian 16-bit integer)
-
lelong (little-endian 32-bit integer)
-
ledate (little-endian 32-bit integer date)
o
3 -- contents of data to match
o
4 -- file description/MIME type if matched
o
5 -- optional MIME encoding if matched and if above was a MIME type
Show file
Open project: bcosca/fatfree-core
Class Usage Examples
Public Methods
Method Details
clear()
abstract public method
exists()
abstract public method
Return TRUE if key is not empty
get()
abstract public method
offsetexists()
public method
Convenience method for checking property value
offsetget()
public method
Convenience method for retrieving property value
offsetset()
public method
Convenience method for assigning property value
offsetunset()
public method
Convenience method for removing property value
set()
abstract public method
abstract public set ( $key, $val ) : mixed |
$key |
|
string |
$val |
|
mixed |
return |
mixed |
|