国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

? ??? ?? PHP ???? PHP? ??? ?? ???? ?? ???

PHP? ??? ?? ???? ?? ???

Jul 25, 2016 am 08:56 AM

  1. /**
  2. * ?? ???? ?? ???
  3. * ???: bbs.it-home.org
  4. * ?:
  5. * $fileutil = new fileDirUtil()
  6. * $fileutil->createDir( 'a/1/2/3'); ?? ?? ??? ?? ?? a/1/2/3
  7. * $fileutil->createFile('b/1/2/3') ?? ??? b/1/2/ ?? ?? 3? ??
  8. * $fileutil->createFile('b/1/2/3.txt'); b/1/2/? ?? ?? ?? ??? file
  9. * $fileutil->writeFile('b/1/2/3.txt','this is what i write!') ?? ??? 3.exe ??? ?????.
  10. * $arr = $fileutil->readFile2array('example/mysql.txt')
  11. * $arr = $fileutil->readsFile('example/mysql.txt')
  12. * $ size=$ fileutil->bitSize($fileutil->getDirSize("example")); ?? ?? ???? ?? ????
  13. * $fileutil->copyDir('b','d/e' ); ?? ?? ??? ??? d/e ??? ??? b ??? ??? ??? ?????
  14. * $fileutil->copyFile('b/1/2/3.exe','b/ b/3.exe' ); ?? ??? ????? b/b ??? ??? b/1/2 ??? ?? 3.exe ??? ?? ??? ?????.
  15. * $fileutil->moveDir('a/' ,'b/c'); ?? ??? ????? b/c ??? ???? a ??? ??? ?? ??? ??? ? a ??? ?????
  16. * $fileutil->moveFile('b/1/ 2/3 .exe','b/d/3.exe'); ?? ??? ????? b/d ??? ??? b/1/2? 3.exe? ?? ??? ?????.
  17. * $fileutil->unlinkFile ('b/d/3.exe'); b/d/3.exe ??? ????? ??????
  18. * $fileutil->unlinkDir('d'); d ?? ??
  19. * $list = $fileutil->dirList("E:example"); ??? ?? ???? ????? ?? ??? ?????.
  20. * $list = $fileutil->dirTree("/ "); ??? ?? ?? ??? ????? ?? ?? ??? ???? ?? ??? ?????
  21. */
  22. class fileDirUtil {
  23. /**
  24. * ?? ???
  25. *
  26. * @param string $aimUrl
  27. * @return viod
  28. */
  29. function createDir($aimUrl, $mode = 0777) {
  30. $aimUrl = str_replace ( '', '/', $aimUrl );
  31. $aimDir = '';
  32. $arr = ??( '/', $aimUrl );
  33. foreach ( $arr as $str ) {
  34. $aimDir .= $str . '/';
  35. if (!file_exists ( $aimDir )) {
  36. mkdir ( $aimDir, $mode );
  37. }
  38. }
  39. }
  40. /**
  41. * ?? ??
  42. *
  43. * @param string $aimUrl
  44. * @param boolean $overWrite ? ????? ?? ??? ???? ??? ?????.
  45. * @return boolean
  46. */
  47. function createFile($aimUrl, $overWrite = false) {
  48. if (file_exists ( $aimUrl ) && $ overWrite == false) {
  49. return false;
  50. } elseif (file_exists ( $aimUrl ) && $overWrite == true) {
  51. $this->unlinkFile ( $aimUrl );
  52. }
  53. $aimDir = ???? ??( $aimUrl );
  54. $this->createDir( $aimDir );
  55. ??( $aimUrl );
  56. true? ?????.
  57. }
  58. /**
  59. * ?? ??
  60. *
  61. * @param string $oldDir
  62. * @param string $aimDir
  63. * @param boolean $overWrite ? ????? ?? ??? ???? ??? ?????.
  64. * @ ?? ?? ??
  65. */
  66. function moveDir($oldDir, $aimDir, $overWrite = false) {
  67. $aimDir = str_replace ( '', '/', $aimDir );
  68. $aimDir = substr ( $aimDir, - 1 ) == '/' ? $aimDir : $aimDir . '/';
  69. $oldDir = str_replace ( '', '/', $oldDir );
  70. $oldDir = substr ( $oldDir, - 1 ) == '/' ? $oldDir : $oldDir . '/';
  71. if (!is_dir ( $oldDir )) {
  72. return false;
  73. }
  74. if (!file_exists ( $aimDir )) {
  75. $this->createDir ( $aimDir );
  76. }
  77. @$dirHandle = opendir ( $oldDir );
  78. if (! $dirHandle) {
  79. false? ?????.
  80. }
  81. while ( false !== ($file = readdir ( $dirHandle )) ) {
  82. if ($file == '.' || $file == '..') {
  83. ?????;
  84. }
  85. if (!is_dir ( $oldDir . $file )) {
  86. $this->moveFile ( $oldDir . $file, $aimDir . $file, $overWrite );
  87. } else {
  88. $this->moveDir ( $oldDir . $file, $aimDir . $file, $overWrite );
  89. }
  90. }
  91. closeir( $dirHandle );
  92. rmdir( $oldDir )? ?????.
  93. }
  94. /**
  95. * ?? ??
  96. *
  97. * @param string $fileUrl
  98. * @param string $aimUrl
  99. * @param boolean $overWrite ? ????? ?? ??? ???? ??? ?????.
  100. * @return ??
  101. */
  102. function moveFile($fileUrl, $aimUrl, $overWrite = false) {
  103. if (!file_exists ( $fileUrl )) {
  104. return false;
  105. }
  106. if (file_exists ( $aimUrl ) && $overWrite = false) {
  107. return false;
  108. } elseif (file_exists ( $aimUrl ) && $overWrite = true) {
  109. $this->unlinkFile ( $aimUrl );
  110. }
  111. $aimDir = ???? ??( $aimUrl );
  112. $this->createDir( $aimDir );
  113. ?? ???( $fileUrl, $aimUrl );
  114. true? ?????.
  115. }
  116. /**
  117. * ?? ??
  118. *
  119. * @param string $aimDir
  120. * @return boolean
  121. */
  122. function unlinkDir($aimDir) {
  123. $aimDir = str_replace ( '', '/', $aimDir );
  124. $aimDir = substr ( $aimDir, - 1 ) == '/' ? $aimDir : $aimDir . '/';
  125. if (!is_dir ( $aimDir )) {
  126. return false;
  127. }
  128. $dirHandle = opendir ( $aimDir );
  129. while ( false !== ($file = readdir ( $dirHandle )) ) {
  130. if ($file == '.' || $file == '..') {
  131. ??;
  132. }
  133. if (!is_dir ( $aimDir . $file )) {
  134. $this->unlinkFile ( $aimDir . $file );
  135. } else {
  136. $this->unlinkDir ( $aimDir . $file );
  137. }
  138. }
  139. closeir( $dirHandle );
  140. rmdir( $aimDir )? ?????.
  141. }
  142. /**
  143. * ?? ??
  144. *
  145. * @param string $aimUrl
  146. * @return boolean
  147. */
  148. function unlinkFile($aimUrl) {
  149. if (file_exists ( $aimUrl )) {
  150. unlink ( $aimUrl );
  151. true? ?????.
  152. } else {
  153. false? ?????.
  154. }
  155. }
  156. /**
  157. * ?? ??
  158. *
  159. * @param string $oldDir
  160. * @param string $aimDir
  161. * @param boolean $overWrite ? ????? ?? ??? ???? ??? ?????.
  162. * @ ?? ?? ??
  163. */
  164. function copyDir($oldDir, $aimDir, $overWrite = false) {
  165. $aimDir = str_replace ( '', '/ ', $aimDir );
  166. $aimDir = substr ( $aimDir, - 1 ) == '/' ? $aimDir : $aimDir . '/';
  167. $oldDir = str_replace ( '', '/', $oldDir );
  168. $oldDir = substr ( $oldDir, - 1 ) == '/' ? $oldDir : $oldDir . '/';
  169. if (!is_dir ( $oldDir )) {
  170. return false;
  171. }
  172. if (!file_exists ( $aimDir )) {
  173. $this->createDir ( $aimDir );
  174. }
  175. $dirHandle = opendir ( $oldDir );
  176. while ( false !== ($file = readdir ( $dirHandle )) ) {
  177. if ($file == '.' || $file == '..') {
  178. ??;
  179. }
  180. if (!is_dir ( $oldDir . $file )) {
  181. $this->copyFile ( $oldDir . $file, $aimDir . $file, $overWrite );
  182. } else {
  183. $this->copyDir ( $oldDir . $file, $aimDir . $file, $overWrite );
  184. }
  185. }
  186. return closeir( $dirHandle );
  187. }
  188. /**
  189. * ?? ??
  190. *
  191. * @param string $fileUrl
  192. * @param string $aimUrl
  193. * @param boolean $overWrite ? ????? ?? ??? ???? ??? ?????.
  194. * @return ??
  195. */
  196. function copyFile($fileUrl, $aimUrl, $overWrite = false) {
  197. if (!file_exists ( $fileUrl )) {
  198. return ??;
  199. }
  200. if (file_exists ( $aimUrl ) && $overWrite == false) {
  201. return false;
  202. } elseif (file_exists ( $aimUrl ) && $overWrite == true) {
  203. $this->unlinkFile ( $aimUrl );
  204. }
  205. $aimDir = ???? ??( $aimUrl );
  206. $this->createDir( $aimDir );
  207. ??( $fileUrl, $aimUrl );
  208. true? ?????.
  209. }
  210. /**
  211. * ??? ??? ??
  212. *
  213. * @param string $filename ?? ??
  214. * @param boolean $str ? ?? ???
  215. */
  216. function writeFile($filename, $str) {
  217. if (function_exists ( file_put_contents )) {
  218. file_put_contents ( $filename, $str ) ;
  219. } else {
  220. $fp = fopen ( $filename, "wb" );
  221. fwrite ( $fp, $str );
  222. fclose( $fp );
  223. }
  224. }
  225. /**
  226. * ?? ?? ??? ???? ?????.
  227. *
  228. * @param string $filename filename
  229. * @return array
  230. */
  231. function readsFile($filename) {
  232. if (function_exists ( file_get_contents )) {
  233. return file_get_contents ( $filename );
  234. } else {
  235. $fp = fopen ( $filename, "rb" );
  236. $str = fread ( $fp, ?? ?? ( $filename ) );
  237. fclose( $fp );
  238. $str? ?????;
  239. }
  240. }
  241. /**
  242. * ?? ??? ??? ?????.
  243. *
  244. * @param string $filename ?? ??
  245. * @return ??
  246. */
  247. function readFile2array($filename) {
  248. $file = ??( $filename );
  249. $arr = ??();
  250. foreach( $file as $value ) {
  251. $arr [] = ??( $value );
  252. }
  253. $arr ??;
  254. }
  255. /**
  256. * /? ??
  257. *
  258. * @param string $path path
  259. * @return string path
  260. */
  261. function dirPath($path) {
  262. $path = str_replace ( '\', '/', $path );
  263. if (substr ( $path, - 1 ) != '/')
  264. $path = $path . '/';
  265. $path? ?????.
  266. }
  267. /**
  268. * ???? ??? ?? ?? ??? ??? ?????.
  269. *
  270. * @param string $in_charset ?? ?? ??
  271. * @param string $out_charset ?? ?? ??
  272. * @param string $dir ???? ??
  273. * @param string $fileexts ??? ?? ??
  274. * @return string ?? ?? ??? ?? ?? ??? ???? false? ????, ??? ??? true? ?????.
  275. */
  276. ?? dirIconv($in_charset, $out_charset, $dir, $fileexts = 'php|html|htm|shtml|shtm|js|txt|xml' ) {
  277. if ($in_charset == $out_charset)
  278. return false;
  279. $list = $this->dirList ( $dir );
  280. foreach ( $list as $v ) {
  281. if (preg_match ( "/.($fileexts)/i", $v ) && is_file ( $v )) {
  282. file_put_contents ( $v, iconv ( $in_charset, $out_charset, file_get_contents ( $v ) ) );
  283. }
  284. }
  285. true? ?????.
  286. }
  287. /**
  288. * ????? ?? ?? ?? ??
  289. *
  290. * @param string $path path
  291. * @param string $exts Extension
  292. * @param array $list ??? ?? ??
  293. * @return array ??? ???? ?? ??
  294. */
  295. function dirList($path, $exts = '', $list = array()) {
  296. $path = $this->dirPath ($??);
  297. $files = glob ( $path . '*' );
  298. foreach ( $files as $v ) {
  299. $fileext = $this->fileext ( $v );
  300. if (! $exts || preg_match ( "/.($exts)/i", $v )) {
  301. $list [] = $v;
  302. if (is_dir ( $v )) {
  303. $list = $this->dirList ( $v, $exts, $list );
  304. }
  305. }
  306. }
  307. return $list;
  308. }
  309. /**
  310. * ?? ????? ?? ?? ??? ?? ? ?? ??? ??
  311. *
  312. * @param string $path path
  313. * @param int $mtime ?? ??
  314. * @param int $atime access Time
  315. * @return ??? ????? ??? false? ????, ??? ??? true? ?????.
  316. */
  317. function dirTouch($path, $mtime = TIME, $atime = TIME) {
  318. if (!is_dir ( $path ))
  319. ??? ??;
  320. $path = $this->dirPath ( $path );
  321. if (!is_dir ( $path ))
  322. touch ( $path, $mtime, $atime );
  323. $files = glob ( $path . '*' );
  324. foreach ( $files as $v ) {
  325. is_dir ( $v ) ? $this->dirTouch( $v, $mtime, $atime ) : ??( $v, $mtime, $atime );
  326. }
  327. true? ?????.
  328. }
  329. /**
  330. * ???? ??
  331. *
  332. * @param string $dir ??
  333. * @param int $parentid ?? ID
  334. * @param array ????? ??? $dirs
  335. * @return ?? ???? ? ?? ???? ??? ?????
  336. */
  337. function dirTree($dir, $parentid = 0, $dirs = array()) {
  338. ?? $id;
  339. if ($parentid == 0)
  340. $id = 0;
  341. $list = glob ( $dir . '*' );
  342. foreach ( $list as $v ) {
  343. if (is_dir ( $v )) {
  344. $id ;
  345. $dirs [$id] = ??('id' => $id, 'parentid' => $parentid, 'name' => ?? ??( $v ), 'dir' => $v .'/' );
  346. $dirs = $this->dirTree ( $v . '/', $id, $dirs );
  347. }
  348. }
  349. return $dirs;
  350. }
  351. /**
  352. * ???? ??
  353. *
  354. * @param string $dir path
  355. * @return array ???? ?? ??
  356. */
  357. function dirNodeTree($dir) {
  358. $d = dir ( $dir );
  359. $dirs = ??();
  360. while ( false !== ($entry = $d->read ()) ) {
  361. if ($entry != '.' and $entry != '..' and is_dir ( $dir . '/' . $entry )) {
  362. $dirs[] = $entry;
  363. }
  364. }
  365. return $dirs;
  366. }
  367. /**
  368. * ???? ?? ????
  369. *
  370. * @param string $dirname ????
  371. * @return ??? ?? B
  372. */
  373. function getDirSize($dirname) {
  374. if (!file_exists ( $dirname ) ?? !is_dir ( $dirname ))
  375. return false;
  376. if (! $handle = opendir ( $dirname ))
  377. return false;
  378. $?? = 0;
  379. while ( false !== ($file = readdir ( $handle )) ) {
  380. if ($file == "." or $file == "..")
  381. ??;
  382. $file = $dirname . "/" . $??;
  383. if (is_dir ( $file )) {
  384. $size = $this->getDirSize ( $file );
  385. } else {
  386. $size = ?? ??( $file );
  387. }
  388. }
  389. closeir ( $handle );
  390. $size? ?????.
  391. }
  392. /**
  393. * ???? Kb ?? Mb? ??...
  394. * $size ????? ??? ?????.
  395. */
  396. function bitSize($size) {
  397. if (! preg_match ( "/^[0-9] $/", $num ))
  398. 0? ?????.
  399. $type = array ("B", "KB", "MB", "GB", "TB", "PB" );
  400. $j = 0;
  401. while ( $num >= 1024 ) {
  402. if ($j >= 5)
  403. return $num . $?? [$j];
  404. $num = $num / 1024;
  405. $j ;
  406. }
  407. $num? ?????. $?? [$j];
  408. }
  409. /**
  410. * ?? ?? ??? ????
  411. *
  412. * @param string $filename
  413. * @return string
  414. */
  415. function fileext($filename) {
  416. return addlashes ( Trim ( substr ( strrchr ( $filename, '.' ), 1, 10 ) ) );
  417. }
  418. }
  419. ?>
復(fù)代碼


? ????? ??
? ?? ??? ????? ???? ??? ??????, ???? ?????? ????. ? ???? ?? ???? ?? ??? ?? ????. ???? ??? ???? ???? ??? ?? 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)

???

??? ??

??? ????
1601
29
PHP ????
1502
276
???
PHP ?? ??? ??????? PHP ?? ??? ??????? Jul 17, 2025 am 04:16 AM

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

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 18, 2025 am 04:57 AM

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

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

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

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

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

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

tolearnpheffectical, startBysetTupaloCalserErverEnmentUsingToolslikexamppandacodeeditor -likevscode.1) installxamppforapache, mysql, andphp.2) useacodeeditorforsyntaxsupport.3)) 3) testimplephpfile.next, withpluclucincludechlucincluclucludechluclucled

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

PHP??? ???? ??? ?? ?? ????? ???? ??? ?? ??? ??? ?? ? ??? ??? ???? ?????. ???? 0?? ???? ?? ??? ???? ? ?? ???? ?? ?? ? ? ????. MB_SUBSTR? ?? ??? ??? ???????. ? : $ str = "hello"; echo $ str [0]; ?? H; ??? MB_SUBSTR ($ str, 1,1)? ?? ??? ??? ??? ??????. ?? ???????? ???? ??? ???? ?? ???? ?? ?? ???? ?????? ??? ????? ?? ??? ?? ??? ???? ???? ?? ????.

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

toinstallphpquickly, usexampponwindowsorhomebrewonmacos.1. ??, downloadandinstallxAmpp, selectComponents, startApache ? placefilesinhtdocs.2

See all articles