亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

? ??? ?? PHP ???? PHP ??? ??? ???? ???? ?? ?? ?? ???? ???? ?? ?? ???? ?????.

PHP ??? ??? ???? ???? ?? ?? ?? ???? ???? ?? ?? ???? ?????.

Jul 25, 2016 am 08:46 AM

??? ???, PHP
{Y}{m}{n}? ???? ?? ??? ??? ? ????
  1. set_dir(dirname(__FILE__).'/upload/','{y}/{m} '); //?? ??, {y}{m}wjcelcm34c ?? ??
  2. $up->set_thumb(100,80); //??? ?? ??? ??
  3. $up- >set_watermark(dirname(__FILE__).'/jblog/images/watermark.png',6,90); //???? ??
  4. $fs = $up->execute() //?? ??
  5. var_dump($fs); //???? ??? ??
  6. }
  7. ?>
  8. /////?? ??---------
  9. test
  10. //?? ??? ??? ??
  11. */
  12. class upload {
  13. var $dir; //????? ???? ??? ????
  14. var $time; //?? ??? ?? ??
  15. var $allow_types; //???? ?? ??? ??
  16. var $field; > var $maxsize; //?? ?? ?? ??(KB)
  17. var $thumb_width; //??? ??
  18. var $thumb_height; //??? ??
  19. // ???? ??? ??
  20. var $watermark_pos; //???? ??
  21. var $watermark_trans;//???? ???
  22. //Constructor
  23. //$types: ???? ? ?? ?? ??, $ maxsize: ??? ??, $field: ??? ?? ??, $time: ??? ?? ??? ??
  24. function upload($types = 'jpg|png', $maxsize = 1024, $field = 'attach', $time = '' ) {
  25. $this->allow_types =explore('|',$types)
  26. $this->maxsize = $maxsize * 1024; $this ->field = $field;
  27. $this->time = $time ? $time : time()
  28. }
  29. //??? ???? ?? ????? ???? ?????.
  30. //$basedir : ?? ????, ?? ???? ???
  31. //$filedir: ??? ?? ?? ????, ?? ??? ???? {y}, {m}, wjcelcm34c
  32. function set_dir($basedir,$filedir = '') {
  33. $dir = $basedir;
  34. !is_dir($dir) && @mkdir($dir,0777)
  35. if (!empty($filedir)) {
  36. $ filedir = str_replace(array( '{y}','{m}','wjcelcm34c'),array(date('Y',$this->time),date('m',$this- >time),date ('d',$this->time)),strtolower($filedir));//string_replace? ???? {y} {m} wjcelcm34c ?? ??
  37. $ dirs =explore('/',$ filedir);
  38. foreach ($dirs as $d) {
  39. !empty($d) && $dir .= $d.'/'
  40. !is_dir ($dir) && @mkdir($ dir,0777);
  41. }
  42. }
  43. $this->dir = $dir;
  44. }
  45. //?? ??? ??, ???? ?? ?? ??? ??? ????. ???
  46. //$width: ??? ??, $height: ??? ??
  47. function set_thumb ($width = 0, $height = 0) {
  48. $this ->thumb_width = $width; $this->thumb_height = $height;
  49. }
  50. //?? ???? ??, ????? ???? ??? ?? ?? ??
  51. // $file: ???? ???, $pos: ???? position, $trans: ???? ???
  52. function set_watermark ($file, $pos = 6, $trans = 80) {
  53. $this->watermark_file = $file
  54. $this->watermark_pos = $pos
  55. $this->watermark_trans = $trans
  56. }
  57. /*————————————————————————-
  58. ?? ???? ???? ??? ??? ??? ?? ?? ??? ?????. ?? ? ??.
  59. ? ? name? ?? ?????. ???? ??? ???? ?? ?? ?????. ???? ???? ?? ??? ???? ?? ?? ?????.
  60. ??? ???? ????
  61. ???? ???? ?? ????. 1? ??? ????, -1? ?? ??? ???? ??? ????, -2? ?? ???
  62. ? ???? ?????. —————— —————————————— ——–*/
  63. function excute() {
  64. $files = array(); //?? ?? ??? ??
  65. $field = $ this->field
  66. $keys = array_keys( $_FILES[$field]['name']);
  67. foreach ($keys as $key) {
  68. if (!$_FILES[$field ]['name'][$key]) ??; ??>
  69. $fileext = $this->fileext($_FILES[$field]['name'][$key]); //?? ??? ????
  70. $filename = date('Ymdhis', $this->time).mt_rand(10,99).'.'.$fileext; //??? ??
  71. $filedir = $this- >dir; //????? ??? ?? ????
  72. $filesize = $_FILES[$field]['size'][$key]; //?? ??
  73. //?? ??? ???? ????
  74. if (!in_array($fileext,$this ->allow_types)) {
  75. $files[$key]['name'] = $_FILES[$field]['name'][$key]; $files[$key]['flag '] = -1;
  76. ??;
  77. }
  78. //?? ?? ??
  79. if ($filesize > $this-> ;maxsize) {
  80. $files[$ ?]['??'] = $_FILES[$??]['??'][$key]
  81. $files[$key]['name'] = $filesize; ]['flag'] = -2;
  82. ??;
  83. }
  84. $files[$key]['name'] = $filename ; 'dir'] = $filedir;
  85. $files[$key]['size'] = $filesize;
  86. //???? ??? ???? ?? ??? ?????.
  87. if (is_uploaded_file( $_FILES[$field]['tmp_name'][$key])) {
  88. move_uploaded_file($_FILES[$field]['tmp_name'][$key],$filedir .$filename)
  89. @ unlink($_FILES[$field]['tmp_name'][$key]);
  90. $files[$key]['flag'] = 1;
  91. //??? ????? ???? ??? ??? jpg ? png? ?????(gif? ???? ???? ?????)
  92. if (in_array($fileext,array('jpg','png') )) {
  93. if ($this->thumb_width) {
  94. if ($this->create_thumb($filedir.$filename,$filedir.'thumb_'.$filename)) {
  95. $ ??[$key][ 'thumb'] = 'thumb_'.$filename; //??? ?? ??
  96. }
  97. }
  98. $this->create_watermark($filedir.$filename);
  99. }
  100. return $files;
  101. }
  102. //??? ??, ??? ???? ???? ??? ??
  103. // $src_file: ?? ??? ??, $thumb_file: ??? ??
  104. function create_thumb ($src_file,$thumb_file) {
  105. $t_width = $this->thumb_width;
  106. $t_height = $this-> Thumb_height; file_exists($src_file)) return false
  107. $src_info = getImageSize($src_file);
  108. //?? ???? ????? ??? ?? ?? ?? ???? ??? ?? ?????. ??? ?? ?? ???
  109. if ($src_info[0] <= $t_width && $src_info[1] <= $t_height) {
  110. if (!copy($src_file ,$thumb_file) ) {
  111. return false
  112. }
  113. return true
  114. }
  115. //??? ??? ????? ??
  116. if (($src_info[0 ]-$t_width) > ; ($src_info[1]-$t_height)) {
  117. $t_height = ($t_width / $src_info[0]) * $src_info[1]
  118. } else {
  119. $t_width = ($ t_height / $src_info[1]) * $src_info[0]
  120. }
  121. //?? ??? ????
  122. $fileext = $this->fileext($src_file)
  123. switch ($fileext) {
  124. case 'jpg' :
  125. $src_img = ImageCreateFromJPEG($src_file);
  126. ??? 'png' :
  127. $src_img = ImageCreateFromPNG($src_file)
  128. ??? 'gif' :
  129. $src_img = ImageCreateFromGIF ($src_file); break;
  130. //?? ?? ??? ??? ??
  131. $thumb_img = @ImageCreateTrueColor($t_width,$t_height) / ??? /ImageCopyResampled ??? ???? ????? ? ?? ????? ?????.
  132. if (function_exists('imagecopyresampled')) {
  133. @ImageCopyResampled($thumb_img,$src_img,0,0,0,0,$t_width,$ t_height,$src_info[0],$src_info[1]);
  134. } else {
  135. @ImageCopyReized($thumb_img,$src_img,0,0,0,0,$t_width,$t_height,$src_info[ 0],$src_info[1])
  136. }
  137. //??? ??
  138. switch ($fileext) {
  139. case 'jpg' :
  140. ImageJPEG($thumb_img, $ Thumb_file);
  141. Case 'gif' :
  142. ImageGIF($thumb_img,$thumb_file); break;
  143. ImagePNG($thumb_img,$thumb_file); ??> }
  144. //?? ??? ??
  145. @ImageDestroy($src_img);
  146. @ImageDestroy($thumb_img)
  147. return true;
  148. //??? ???? ??
  149. //$file : ????? ??? ??
  150. function create_watermark ($file) {
  151. //??? ??? ??
  152. if (!file_exists($this->watermark_file) || !file_exists($file)) return
  153. if (!function_exists('getImageSize')) return
  154. //?? GD ???? ?? ??
  155. $gd_allow_types = array();
  156. if (function_exists('ImageCreateFromGIF')) $gd_allow_types['image/gif'] = 'ImageCreateFromGIF'
  157. if (function_exists('ImageCreateFromPNG') )) $gd_allow_types['image/png'] = 'ImageCreateFromPNG';
  158. if (function_exists('ImageCreateFromJPEG')) $gd_allow_types['image/jpeg'] = 'ImageCreateFromJPEG'
  159. // ?? ?? ????
  160. $fileinfo = getImageSize($file)
  161. $wminfo = getImageSize($this->watermark_file)
  162. if ($fileinfo[0] < $wminfo[0 ] || $fileinfo[1] < $wminfo[1]) return
  163. if (array_key_exists($fileinfo['mime'],$gd_allow_types)) {
  164. if (array_key_exists($wminfo) ['mime'],$gd_allow_types)) {
  165. //???? ??? ??
  166. $temp = $gd_allow_types[$fileinfo['mime']]($file)
  167. $temp_wm = $gd_allow_types[$wminfo['mime']]($this->watermark_file);
  168. //???? ??
  169. ???($this->watermark_pos) {
  170. ?? 1: //?? ??
  171. $dst_x = 0; $dst_y = 0; break;
  172. ?? 2 : //?? ??
  173. $dst_x = ($fileinfo[0] - $wminfo[0])/2 ; $dst_y = 0;
  174. ??? 3 : //??? ?
  175. $dst_x = $dst_y = 0;
  176. ??? 4 : //??
  177. $dst_x = 0; $dst_y = $fileinfo[1];
  178. ?? 5 : // ?? ??
  179. $dst_x = ($fileinfo[0] - $wminfo[0]) / 2; = $fileinfo[1]; ??;
  180. ?? 6: //??? ??
  181. $dst_x = $fileinfo[0]-$wminfo[0]; ]; ??;
  182. ??? : //Random
  183. $dst_x = mt_rand(0,$fileinfo[0]-$wminfo[0]) $dst_y = mt_rand(0,$fileinfo[1]- $wminfo [1]) }
  184. if (function_exists('ImageAlphaBlending')) ImageAlphaBlending($temp_wm,True); //??? ??? ?? ??
  185. if (function_exists(' ImageSaveAlpha') ) ImageSaveAlpha($temp_wm,True); //?? ?? ?? ?? ??
  186. //???? ???? ??
  187. if (function_exists('imageCopyMerge')) {
  188. ImageCopyMerge( $temp ,$temp_wm,$dst_x,$dst_y,0,0,$wminfo[0],$wminfo[1],$this->watermark_trans)
  189. }else {
  190. ImageCopyMerge($temp,$temp_wm,$dst_x,$dst_y,0,0,$wminfo[0],$wminfo[1])
  191. }
  192. //?? image
  193. ???($fileinfo['mime']) {
  194. ??? 'image/jpeg' :
  195. @imageJPEG($temp,$file)
  196. break
  197. ??? 'image/ png ' :
  198. @imagePNG($temp,$file);
  199. break
  200. case 'image/gif' :
  201. @imageGIF($temp,$file); ?? > }
  202. //???? ??? ??
  203. @imageDestroy($temp)
  204. @imageDestroy($temp_wm)
  205. }
  206. }
  207. }
  208. / /?? ??? ????
  209. function fileext($filename) {
  210. return strtolower(substr(strrchr($filename,'.'),1,10))
  211. }
  212. }
  213. ?>
?? ??

? ??? Xiaobei? 2015-11-18 08:23? ??????
? ????? ??
? ?? ??? ????? ???? ??? ??????, ???? ?????? ????. ? ???? ?? ???? ?? ??? ?? ????. ???? ??? ???? ???? ??? ?? admin@php.cn?? ?????.

? AI ??

Undresser.AI Undress

Undresser.AI Undress

???? ?? ??? ??? ?? AI ?? ?

AI Clothes Remover

AI Clothes Remover

???? ?? ???? ??? AI ?????.

Video Face Swap

Video Face Swap

??? ??? AI ?? ?? ??? ???? ?? ???? ??? ?? ????!

???

??? ??

???++7.3.1

???++7.3.1

???? ?? ?? ?? ???

SublimeText3 ??? ??

SublimeText3 ??? ??

??? ??, ???? ?? ????.

???? 13.0.1 ???

???? 13.0.1 ???

??? PHP ?? ?? ??

???? CS6

???? CS6

??? ? ?? ??

SublimeText3 Mac ??

SublimeText3 Mac ??

? ??? ?? ?? ?????(SublimeText3)

???

??? ??

??? ????
1597
29
PHP ????
1487
72
NYT ?? ??? ??
129
836
???
? ?? PHP ?? ?? ?? ???? ??? ?????? ? ?? PHP ?? ?? ?? ???? ??? ?????? Jul 02, 2025 pm 05:18 PM

? ?? PHP ??? ???? ?? ? ?? ????? ? ?? ?? ??? ????. 1. ??? ??? ?? ?? ??? ?? Array_Merge ? Array_unique ??? ??????. ?? Array_Merge ($ array1, $ array2)? ?? ? ?? Array_Unique ()? ???? ?? ?? ? ?? ???? ? ??? ?????. 2. ?? ?? ? ? ?? ???? ? ? ?? ????? ???? ??????. $ result = $ array1 $ array2? ? ?? ??? ?? ? ?? ??? ?? ?? ?? ??????. ? ? ?? ??? ? ??? ????? ??? ?? ?

???? ??? ?? PHP Regex ???? ??? ?? PHP Regex Jul 03, 2025 am 10:33 AM

????? ??? ????? ????? ??? ??? ???????. ?? ?? ??? ??? ????. 1. ??? 8 ?? ?????. 2. ??? ???, ??? ? ??? ?????. 3. ?? ?? ??? ?? ? ? ????. ?? ??? ????, ??? ???? ?? ? ??/?? ???? ?????, ?? PHP ?? ??? ?????. ???, ?????? ???? ?? ? 123456? ?? ???? ?? ??? ????????. ????? ?? ???? ????? ?? ZXCVBN ?????? ???? ?? ????.

PHP?? ?? ???? ???? ???? ??? ?????? PHP?? ?? ???? ???? ???? ??? ?????? Jul 08, 2025 am 02:37 AM

PHP ?? ???? ???? ????? ?? ? ??? ???? ?? ?? ? ??? ???? ?? ??? ?????? ??? ??? ? ? ???????. 1. ??? ?? CSRF? ???? ?? ??? ??? ???? ?????? ??? ???? FINFO_FILE? ?? ?? MIME ??? ?????. 2. ??? ??? ??? ???? ??? ?? ??? ?? ? WEB ????? ??? ???? ??????. 3. PHP ?? ??? ?? ? ?? ???? NGINX/APACHE? ??? ????? ?? ???? ?????. 4. GD ?????? ??? ? ?? ???? ??? ?? ??? ?? ????.

PHP ?? ??? ??????? PHP ?? ??? ??????? Jul 17, 2025 am 04:16 AM

PHP ?? ??? ?? ???? ?? ? ????? ??? ?????. 1. ?? ??? ??? ??? ??? ? ? ??? ??? ??? ?? ?? ??? ???? ???????. 2. ?? ??? ???? ???? ? ?? ????? ?? ?? ?? ??? ?????. 3. $ _get ? $ _post? ?? Hyperglobal ??? ?? ???? ?? ??? ? ??? ??? ??????? ???????. 4. ?? ?? ?? ???? ?? ?? ?? ??? ?????? ?? ??? ??? ?? ??? ???????. ??? ??? ????? ??? ??? ?? ???? ????? ? ??? ? ? ????.

PHP?? ?? ?? PHP?? ?? ?? Jul 18, 2025 am 04:57 AM

PHP ?? ???? ? ?? ???? ??? ????. 1. // ?? #? ???? ? ?? ??? ???? // ???? ?? ????. 2. ?? /.../ ?? ?? ?? ??? ????? ?? ? ?? ??? ?? ? ? ????. 3. ?? ?? ?? / if () {} /? ?? ?? ??? ????? ??? ?? ?? ?? ??? ???? ????? ???? ??? ?? ???? ???? ??? ? ??? ??????.

PHP ?? ?? ? PHP ?? ?? ? Jul 18, 2025 am 04:51 AM

PHP ??? ???? ??? ??? ??? ????? ????. ??? ????? ?? ???? ??? "?? ? ?"??? "?"? ???????. 1. ??? ? ??? ??? DocBlock (/*/)? ?? ?? ??? ???? ??? ? ?? ???? ??????. 2. JS ??? ???? ?? ???? ??? ?? ??? ??? ?????. 3. ??? ?? ?? ?? ??? ???? ????? ????? ???? ?? ????? ???? ? ??????. 4. Todo ? Fixme? ????? ???? ? ? ??? ??? ???? ?? ?? ? ??? ???????. ??? ???? ?? ??? ??? ?? ?? ?? ???? ???? ? ????.

PHP?? ???? ??? ?????? PHP?? ???? ??? ?????? Jul 11, 2025 am 03:12 AM

Ageneratorinphpisamemory- ???? Way-Erate-Overgedatasetsetsbaluesoneatimeatimeatimeatimallatonce.1.generatorsuseTheyieldKeywordTocroadtOpvaluesondemand, RetingMemoryUsage.2

PHP?? ??? ??? ??? PHP?? ??? ??? ??? Jul 02, 2025 pm 05:01 PM

PHP?? ??? ???? ? ?? ??? ???? : ?? () ??? ????? ???? ?????? []. 1. ?? () ??? ???? ?? ???? ???? ???? ?????. $ fruits = array ( "Apple", "Banana", "Orange")? ?? ??? ???? ???? $ user = array ( "name"=> "john", "age"=> 25)? ?? ?? ??; 2. [] ??? $ color? ?? PHP5.4 ??? ? ??? ?? ?????.

See all articles