PHP?? ?? ??? SplFileInfo? ???? ??? ??????
Jun 01, 2023 pm 07:01 PM?? ???? ?? ? ????? ??? PHP? ??? ??? ?? ?? ??? ??? ?? ??? ?? ?? ?? ?? ???? ?????. ? ??? ??? ? ??? SplFileInfo???. ?? ?? ?? ?? ? ?? ??? ?? ???? ????? ??? ? ????. ? ????? ?? ??? ?? PHP?? SplFileInfo ???? ???? ??? ?????.
1. SplFileInfo ??? ??
SplFileInfo ???? PHP? ??? ???(?? ?? ?? ??)?, ?? ???? ??? ????? ???? ???? ?????. SplFileInfo ???? ?? ??, ?? ??, ?? ?? ? ??? ?? ??? ??? ?? ? ??? ??? ???? ?????? ??? ?? ????.
?? ??? SplFileInfo ???? ???? ?? ?? SplFileInfo ??? ?? ?? ?? ??? ? ??? ?? ???? ???? ???? ???. ????? SplFileInfo ???? ?? ???? ??? ???????.
2. ?? ??? ??
- getPath() ? getRealPath()
SplFileInfo ???? getPath() ??? ? getRealPath() ???? ??? ?? ????? ??? ???? ? ?????. getPath() ???? ??? ?? ????? ?? ??? ????, getRealPath() ???? ?? ??? ??? ?? ??? ?????. ?? ??? ??? ????.
$file = new SplFileInfo('text.txt'); $path = $file->getPath(); // 返回文件所在目錄的絕對路徑 $realpath = $file->getRealPath(); // 返回包含文件名的完整路徑
- getFilename()
getFilename() ???? ?? ??(?? ??)? ????, ?? ?? ??? ????.
$file = new SplFileInfo('text.txt'); $fileName = $file->getFilename(); // 返回文件名(不含路徑)
- getSize()
getSize() ???? ?? ??? ?????. ??? ????? ????? ??? ?? ?? ??? ?? ??? ????? ???? ? ?????.
$file = new SplFileInfo('text.txt'); $fileSize = $file->getSize(); // 返回文件大小,單位為字節(jié) if ($fileSize > 1024 * 1024) { // 如果文件大小超過1MB,則執(zhí)行某些操作 }
- getATime(), getMTime() ? getCTime()
getATime() ??? ??? ?? ??? ??? ??? ??? ??(Access Time)? ?????. getMTime() ???? ??? ?? ??? ??? ??? ?? ??(Modify Time)? ?????. getCTime() ???? ?? ?? ??(Create Time)? ?????. ??? ???? ?? ????? ???? ??? ?????.
$file = new SplFileInfo('text.txt'); $accessTime = $file->getATime(); // 返回文件最后一次訪問時間,時間戳格式 $modifyTime = $file->getMTime(); // 返回文件最后一次修改時間,時間戳格式 $createTime = $file->getCTime(); // 返回文件創(chuàng)建時間,時間戳格式
- getType()
getType() ???? ?? ??, ? ??, ???? ?? ??(??? ??, ?? ?? ?)? ?????. gettype() ???? ?? ?? ?? ?? ? ?????.
- SplFileInfo :: Type_file -File
- SplFileInfo :: Type_dir -Directory
- SplFileInfo :: Type_link
- SplFileInfo :: Type_fifo - ??? ?? ??道SplFileInfo::TYPE_CHAR - ?? ??
- SplFileInfo::TYPE_BLK - ?? ??
- SplFileInfo::TYPE_UNKNOWN - ?? ??
$file = new SplFileInfo('text.txt'); $fileType = $file->getType(); // 返回文件類型 if ($fileType == SplFileInfo::TYPE_FILE) { // 如果是文件,則執(zhí)行某些操作 }
3. ?? ?? ??
- isFile() ? isDir()
isFile( ) ?? ??? ???? ??? ???? ?? ???? ????, ?? ??? ?????? ??? ???? ?? isDir() ???? ?????. ? ? ???? ?? ?? ?? ?????. ?? ??? ??? ????.
$file = new SplFileInfo('text.txt'); if ($file->isFile()) { // 如果是文件,則執(zhí)行某些操作 } if ($file->isDir()) { // 如果是目錄,則執(zhí)行某些操作 }
- openFile()
openFile() ???? ??? ?? ? ?? ?? ?? ? ?? ??? ?? SplFileObject ??? ???? ? ?????. ??. openFile() ???? ???? ?? ??, ?? ??, ?? ? ??? ??? ??? ? ? ????. ?? ??? ??? ????.
$file = new SplFileInfo('text.txt'); $fileObject = $file->openFile('r'); // 以只讀模式打開文件 $fileObject->fgets(); // 讀取一行數(shù)據(jù) $fileObject->fwrite('Hello World'); // 寫入數(shù)據(jù) $fileObject = $file->openFile('a'); // 以追加模式打開同一個文件 $fileObject->fwrite('Bye'); // 再次寫入數(shù)據(jù)
- getPathInfo()
getPathInfo() ???? ?????. ?? ??? ???? SplFileInfo ??. ?? ?? ??? ?? ????? ?? ??? ?? ????? ?? ???? ??? ???? ?? ?? getPathInfo() ???? ??? ? ????. ?? ??? ??? ????.
4. ?? PHP?? SplFileInfo ???? ???? ????? ??? ???? ??? ? ???, ??? ?? ??? ??? ?? ? ?? ?????. ? ???? ??? ? ?? SplFileInfo ??? ?? ?? ?? ??? ? ??? ?? ???? ???? ???? ???. ? ????? ?? ??, ?? ??, ?? ??, ?? ??, ?? ?? ????, ??? ???? ?????? ??, ?? ??, ?? ?? ? ?? ?? ?? ? ????? ???? ??? ?????. ? ??? PHP? ???? ?? ??? ? ? ??? ??? ????.? ??? PHP?? ?? ??? SplFileInfo? ???? ??? ??????? ?? ?????. ??? ??? PHP ??? ????? ?? ?? ??? ?????!

? AI ??

Undress AI Tool
??? ???? ??

Undresser.AI Undress
???? ?? ??? ??? ?? AI ?? ?

AI Clothes Remover
???? ?? ???? ??? AI ?????.

Clothoff.io
AI ? ???

Video Face Swap
??? ??? AI ?? ?? ??? ???? ?? ???? ??? ?? ????!

?? ??

??? ??

???++7.3.1
???? ?? ?? ?? ???

SublimeText3 ??? ??
??? ??, ???? ?? ????.

???? 13.0.1 ???
??? PHP ?? ?? ??

???? CS6
??? ? ?? ??

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

??? ?? ??? ??? ?? JavaScript? MediareCorder API? ?? PHP ???? ???? ?????. 2. PHP? ???? ?? ??? ???? STTAPI (? : Google ?? Baidu ?? ??)? ???? ???? ?????. 3. PHP? ???? AI ??? (? : OpenAigpt)? ????. 4. ?? ?? PHP? TTSAPI (? : Baidu ?? Google ?? ??)? ???? ??? ?? ??? ?????. 5. PHP? ?? ??? ??? ??? ??? ?? ?? ??? ?????. ?? ????? PHP? ?? ???? ?? ?? ?? ??? ??? ?????.

PHP?? ?? ?? ??? ???? ?? ??? ? ???? ?? ??? ???? ?? ??? ???? ???? ????. 1. ?? ?? ??? ?? ??? URL ? ?? ??? ????. 2. UrlenCode? ???? ?? ??? ???????. 3. ? ???? ????? ?? ?? ??? ? ?? ??? ?????. 4. ???? ???? ?? ? ? ??? ??? ??? ??? ?????. 5. ??? ?? ??? ????? ?? ????? OG ??? ???? ?????. 6. XSS ??? ???? ?? ??? ??? ?????. ? ???? ??? ??? ???? ??? ?? ?? ??? ??? ???? ??? ?? ??? ?????.

AI? ??? ??? ?? ?? ? ?? ???? ????? ?? ??? ??????. 1. Baidu, Tencent API ?? ?? ?? NLP ?????? ?? ??? AI ?? ?? API? ??????. 2. PHP? ? ?? guzzle? ?? API? ???? ?? ??? ??????. 3. ?? ????? ?? ?? ??? ???? ???? ???? ??? ??? ? ????. 4. ?? ?? ? ?? ???? ?? PHP-L ? PHP_CODESNIFFER? ??????. 5. ???? ????? ???? ?? ?? ??? ?????? ??? ??????. AIAPI? ??? ? ???, ?? ??, ?? ? PHP ?? ??? ??? ???. ?? ???? PSR ??? ???, ??? ????? ????, ?? ??? ???, ????? ??? ????, X? ???????.

1. ?? ???? ??? ??? ?????? ?? ?? ??? ??, ??? ?? ???? ??? (? : ?? ???, ? ? ??), ?? ??? ?? ???? ???? ? ?? ?? ??? ??? ?? ??? ????????. 2. ?? ??? ??? ?? ? ??? ???? ?? ?? ?? ???? ?? ? ?? AUDIT ?? ??? ??? ? ????? ????? ??? ???????. 3. ?? ?? ??? ?? ??? ???????. Recaptchav3 ???? ??, ??? ?? ?? ?? ?? ??, IP ? ?? ??? ??? ??? ?? ???? ??? ?? ??? ????? ??? ???? ????? ??? ?????.

PHP? AI ??? ??? ?? ????? ??? API? ?? ?????. ??? ??? ????? ? ??? ???? ?????. API ??? ?? ?? ??? ???? ??? ??? ???? ???? ? ????. 2. ?? ?? ???? guzzle ?? curl? ???? HTTP ??? ???, JSON ??? ??? ? ???, API ? ?? ??, ??? ? ?? ??? ???? ??, ??? ?? ?? ? ? ?? ????, ??? ?? ? ?????? ?????. 3. ???? ???? ?? ???? API ??, ?? ? ??? ?? ??, ??? ?? ??, ?? ?? ? ??? ??? ??? ?????. ?? ??? ??? ??? ? ??? ???? Propt ?? ? ?? ?? ??, ??? ?? ? ?? ????, ?? ?? ?? ???? ? ??? ?? ? ???? ????? ?????.

PHP? ?????? ????? ?? ?? ?? ???? ???? ?? ???? ???? ?? ?? ???? ?????. 2. ?? ??? ???? ???? ?? ??? ?? ? ??? ??? ???? ?? API/Webhook ??? ??? ?? ???? ??? ??? ??? ??? ?????. 3. ?? ????? ?? ??, ??/???? ????, ???? ??, ???? ? ??? ?????? ????? ?? ??? ???? ???? ?? Dingtalk, SMS ?? ??? ???? ??? ?????? ???? ?? ? ??? ??? ????? ?? ??? ???? ???????.

PhpisstillRelevantinmodernenterpriseenvironments.1. Modernphp (7.xand8.x)? ??? ??, ??? ??, jitcompilation ? modernsyntax, mateitsuilableforlarge-scalepplications

??? AI ?? ?? ???? ???? PHPSDK? ??????. 2. PHP? ???? FFMPEG? ???? ???? API ?? ?? (? : WAV)?? ?????. 3. ??? ???? ????? ????? API ???? ??? ??????. 4. NLP ??? ???? JSON ??? ???? ???? ?????. 5. ?? ??? ???? ???? ?? ?? ?? ?? ?? ??? ?????. ?? ????? ?? ?? ? ??? ???? ?? ??? ???, ??? ?? ? ??? ???????.
