国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 語言 > PHP > 正文

php安裝php_rar擴展實現rar文件讀取和解壓的方法

2024-05-04 23:52:31
字體:
來源:轉載
供稿:網友

本文實例講述了php安裝php_rar擴展實現rar文件讀取和解壓的方法。分享給大家供大家參考,具體如下:

PHP Rar Archiving 模塊 (php_rar) 是一個讀取和解壓rar文件的模塊,但不提供RAR壓縮(打包)的功能。

1.首先要到PECL的RAR頁面下載DLL. 根據自己的情況選擇下載對應版本的DLL.

PHP版本要求:php_rar模塊適用于php 5.2及以上, 不過對于windows系統,似乎只有php5.3 / 5.4對應的DLL下載。

2.下載到的是個zip包,將其中的php_rar.pdb和php_rar.dll兩個文件解壓到PHP安裝目錄下的ext子目錄中。

3.在php.ini中加入一行php_rar擴展引用聲明 extension=php_rar.dll

4.如果使用Apache服務器,就需要重啟Apache。IIS下以FastCGI模式加載的PHP則不需要進一步操作了。

5.寫個測試文件看看有沒有問題啊

6.如果有問題,查看服務器的日志文件。

附官方的測試代碼test-rar.php :

<?php$archive_name = '/full/path/to/file.rar'$entry_name = 'path/to/archive/entry.txt'; //notice: no slash at the beginning$dir_to_extract_to = '/path/to/extract/dir';$new_entry_name = 'some.txt';$rar = rar_open($archive_name) OR die('failed to open ' . $archive_name);$entry = rar_entry_get($rar, $entry_name) OR die('failed to find ' . $entry_name . ' in ' . $archive_name);// this will create all necessary subdirs under $dir_to_extract_to$entry->extract($dir_to_extract_to); /* OR */// this will create only one new file $new_entry_name in $dir_to_extract_to$entry->extract('', $dir_to_extract_to.'/'.$new_entry_name); // this line is really not necessaryrar_close($rar);?>

希望本文所述對大家PHP程序設計有所幫助。


注:相關教程知識閱讀請移步到PHP教程頻道。
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表

圖片精選

主站蜘蛛池模板: 巴青县| 青海省| 龙州县| 北碚区| 凤山市| 常熟市| 黔东| 天长市| 峨山| 都兰县| 固阳县| 磐石市| 建昌县| 乐东| 吉木萨尔县| 闽侯县| 香河县| 牡丹江市| 高青县| 旬阳县| 邵阳县| 祥云县| 黎川县| 前郭尔| 开平市| 武定县| 固原市| 潞城市| 嫩江县| 丹棱县| 乌鲁木齐县| 荔浦县| 格尔木市| 黎平县| 宁远县| 灵武市| 新民市| 西林县| 临汾市| 武清区| 和林格尔县|