This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 将查询字符串解析为数组 | |
* @param string | |
* @return array | |
*/ | |
private static function _parseQueryString($query = '') | |
{ | |
$res = array(); | |
$pieces = explode('&', trim($query)); | |
foreach ($pieces as $piece) // $piece likes 'serial=123' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (!empty($_FILES)) { | |
switch ($_FILES['voice']['error']) { | |
case UPLOAD_ERR_OK: //上传成功 | |
if (!in_array(Tool_PublicPlatform::get_file_type($_FILES['voice']['tmp_name']), self::$_audioType)) { | |
$res = Comm_I18n::text('ajax.publicplatform.illegal_file_type'); | |
} elseif ($_FILES['voice']['size'] > self::MAX_AUDIO_FILE_SIZE) { | |
$res = Comm_I18n::text('ajax.publicplatform.more_than_max') . '1M...'; | |
} elseif ($_FILES['voice']['size'] == 0) { | |
$res = Comm_I18n::text('ajax.publicplatform.file_size_0M'); | |
} else { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 获取文件类型(通过读取文件前两个字节判断文件类型) | |
* @param string $path 文件绝对路径 | |
* @return string 文件扩展名 | |
*/ | |
public static function get_file_type ( $path = '' ) { | |
$res = ''; | |
if ( file_exists($path) && is_readable($path) ) { | |
$fh = fopen($path, 'rb'); | |
$bin = fread($fh, 2); //只读前两个字节 |
NewerOlder