Bandhingake rong Word nggunakake PHP

Pemeriksa beda PHP sing akurat banget kanggo mbandhingake Word file lan nemokake bedane

PHP SDK kita sing kuat ngidini sampeyan nemokake prabédan antarane Word dokumen lan nyimpen asil menyang format sing trep kanggo dideleng. Kanggo verifikasi kemampuan produk, mbandhingake Word file nggunakake perpustakaan PHP iki lan deleng bedane.

Ndeleng potongan kode

Bandhingake Word ing PHP

Kita PHP SDK dirancang kanggo menehi asil sing paling akurat, sanajan perbandingan minangka fungsi sing kompleks.

Kadhangkala sampeyan kudu mesthekake yen dokumen ing Word format durung diganti, lan yen wis, sampeyan kudu ngerteni apa bedane. Cukup gunakake alat diff PHP kanggo mbandhingake rong Word file lan temokake bedane kabeh tembung utawa karakter tunggal. Kajaba iku, yen mung siji karakter ing tembung sing diganti, tembung iki bakal ditandhani minangka diganti kabeh.

Saiki sampeyan ora perlu maneh nglampahi wektu kanthi manual mbandhingake Word dokumen, lan sampeyan bisa kanthi cepet nemokake owah-owahan cilik lan ngekspor bedane kasebut menyang dokumen kanthi format sing trep.

Coba mbandhingake Word dokumen

Priksa kepiye solusi kanggo mbandhingake Word file nggunakake PHP SDK. Kanggo entuk iki, muat Word file sing pengin dibandhingake lan pilih format file ekspor - bakal dimuat kanthi otomatis sawise mbandhingake.

Elinga yen sampeyan kudu nampa kabeh revisi ing dokumen sing dibandhingake sadurunge nelpon metode perbandingan, kaya sing ditampilake ing conto kita:

Unggah file sing dibandhingake
Kode roto
Unggah file kapindho kanggo mbandhingake
Pilih format target saka dhaptar
use Aspose\Words\WordsApi;

$wordsApi = new WordsApi('####-####-####-####-####', '##################');
$fileName1 = "Input1.docx";
$fileName2 = "Input2.docx";
$fileResult = "Output.docx";

/**
*  Upload dokumen menyang panyimpenan maya.
 */
$firstDocumentContent = $fileName1;
$uploadFirstFileRequest = new UploadFileRequest(
    $firstDocumentContent, $fileName1, NULL
);
$wordsApi->uploadFile($uploadFirstFileRequest);

$secondDocumentContent = $fileName2;
$uploadSecondFileRequest = new UploadFileRequest(
    $secondDocumentContent, $fileName2, NULL
);
$wordsApi->uploadFile($uploadSecondFileRequest);

/**
*  Bandhingake dokumen ing awan.
 */
$compareDataOptions = new CompareData(array(
    "author" => "author",
    "file_reference" => FileReference::fromRemoteFilePath($fileName2)
));
$compareDocumentRequest = new CompareDocumentRequest(
    $fileName1, $compareDataOptions, NULL, NULL, NULL, NULL, NULL, $fileResult, NULL
);
$wordsApi->compareDocument($compareDocumentRequest);

/**
*  Download dokumen asil saka panyimpenan maya.
 */
$downloadFileRequest = new DownloadFileRequest(
    $fileResult, NULL, NULL
);
$downloadFileResult = $wordsApi->downloadFile($downloadFileRequest);
rename(reset($downloadFileResult)->getPathname(), 'compareResult.pdf');
Kode roto
  
Nyalin kode PHP menyang clipboard

Cara mbandhingake rong file teks

  1. Pasang Aspose.Words Cloud for PHP
  2. Tambah referensi perpustakaan (ngimpor perpustakaan) menyang proyek PHP sampeyan
  3. Muat rong Word dokumen kanggo mbandhingake
  4. Telpon metode compareDocument() kanggo mbandhingake Word docs
  5. Download dokumen asil saka panyimpenan maya

PHP perpustakaan kanggo nggunakake mbandhingake

Instal 'Aspose.Words Cloud SDK for PHP' saka gudang Packagist. Mung mbukak composer require aspose-cloud/aspose-words-cloud kanggo nginstal SDK, banjur gunakake require_once('vendor/autoload.php'); kanggo ngimpor menyang proyek sampeyan.

Minangka alternatif, sampeyan bisa kanthi manual kloning Aspose.Words Cloud SDK for PHP saka GitHub. Tututi Instructions iki supaya cepet entuk kredensial keamanan sing dibutuhake lan ngakses REST API kita.

Requirements Sistem

PHP 7.1 utawa luwih anyar

Deleng Repository Documentation kanggo ndeleng rincian liyane.

Format file liyane sing didhukung

Sampeyan bisa nindakake operasi mbandhingake kanggo format file liyane:

5%

Langganan kanggo Aspose Update Product

Entuk buletin saben wulan lan tawaran langsung dikirim menyang kothak layang.

© Aspose Pty Ltd 2001-2024. Kabeh hak dilindhungi undhang-undhang.