6$source =
count($argv) > 1 ? $argv[1] :
'https://cdn.jsdelivr.net/gh/jshttp/mime-db@v1.52.0/db.json';
11 fprintf(STDERR,
"Error: unable to read $source\n");
16$prefs = [
'nginx' => 1,
'apache' => 2,
'custom' => 3,
'iana' => 4];
20foreach (
$types as $mime => $info) {
21 $source = $info[
'source'] ??
'custom';
23 foreach ($info[
'extensions'] ?? [] as $extension) {
27 if ($oldMime !==
'application/octet-stream'
29 || ($oldPref === $pref &&
substr($oldMime, 0, 12) ===
'application/'))) {
42 "jsm" =>
"application/javascript",
49 fprintf(STDERR,
"Ignored exist mime type: $ext => $mime\n");
54 return strcmp($ext1, $ext2);
77#ifndef PHP_CLI_SERVER_MIME_TYPE_MAP_H
78#define PHP_CLI_SERVER_MIME_TYPE_MAP_H
90 echo
"\t{ \"" .addcslashes($extension,
"\0..\37!@\@\177..\377") .
"\", \""
91 .
addcslashes($mime,
"\0..\37!@\@\177..\377") .
"\" },\n";
fprintf($stream, string $format, mixed ... $values)
file_get_contents(string $filename, bool $use_include_path=false, $context=null, int $offset=0, ?int $length=null)
array_map(?callable $callback, array $array, array ... $arrays)
count(Countable|array $value, int $mode=COUNT_NORMAL)
addcslashes(string $string, string $characters)
uksort(array &$array, callable $callback)
substr(string $string, int $offset, ?int $length=null)
json_decode(string $json, ?bool $associative=null, int $depth=512, int $flags=0)
exit(string|int $status=0)
strcmp(string $string1, string $string2)