Sunting MD ing PHP SDK

Gunakake REST API kanggo nyunting MD ing PHP kanthi terprogram

Nalika pangembang ngowahi MD dokumen nganggo perpustakaan PHP iki, sing lagi diowahi yaiku Model Obyek Dokumen (DOM). Dadi, meh kabeh owah-owahan bisa ditindakake kanggo MD dokumen sing diwakili minangka DOM. Kanthi PHP SDK sing disedhiyakake, pangembang bisa kanthi gampang nyunting dokumen: ngowahi teks, nganyari tabel, nambah gambar lan liya-liyane. Cukup mbukak MD, gawe owah-owahan sing dibutuhake kanthi program lan ekspor asil menyang format nyimpen sing padha utawa sing didhukung.

Ndeleng potongan kode

Sunting MD ing PHP nggunakake REST API

Pustaka PHP kita menehi pangembang kemampuan kanggo ngowahi MD dokumen kanthi langsung kanthi nyunting Document Object Model (DOM), tegese ora ana piranti lunak tambahan sing kudu diinstal.

Sunting teks ing MD file nggunakake PHP

Kasus sing paling populer kanggo nyunting MD file yaiku nyunting teks. Kanthi solusi piranti lunak sing diwenehake, sampeyan bisa nambah, ngowahi utawa mbusak teks nggunakake PHP ing dokumen kasebut.

Sunting tabel ing MD file nggunakake PHP

Pilihan editing MD liyane sing populer yaiku nyunting tabel. PHP SDK kita ngidini sampeyan nggarap tabel lan teks ing sel tabel.

Pangembang PHP bisa nambah utawa mbusak sel tabel lan tabel, uga nambah, ngowahi lan mbusak teks ing njero.

Tambah gambar menyang MD file nggunakake PHP

Saliyane nyunting teks lan tabel ing MD, ana pilihan umum liyane: nambahake gambar menyang dokumen ing PHP. Pangembang PHP uga bisa nambah gambar menyang MD file nggunakake DOM.

Sunting MD kanthi terprogram

Coba PHP SDK sing kuat iki lan evaluasi sawetara opsi ing panyuntingan MD dokumen. Nggunakake conto ing ngisor iki, muat MD dokumen lan gawe sawetara owah-owahan: nambah teks, nambah tabel lan sel tabel kanthi teks utawa lebokake gambar menyang MD dokumen:

Unggah dokumen sing pengin diowahi
Kode roto
Unggah gambar sing pengin dilebokake
Pilih format target saka dhaptar
use Aspose\Words\WordsApi;

$wordsApi = new WordsApi('####-####-####-####-####', '##################');

$requestDocument = "Input.md";
$requestParagraph = new ParagraphInsert(array(
    "text" => "Morbi enim nunc faucibus a.",
));
$insertParagraphRequest = new InsertParagraphOnlineRequest(
    $requestDocument, $requestParagraph, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL
);
$insertParagraph = $wordsApi->insertParagraphOnline($insertParagraphRequest);

$convertRequest = new ConvertDocumentRequest(
    array_key_first($insertParagraph->document()->values()), "md", NULL, NULL, NULL, NULL
);
$convert = $wordsApi->convertDocument($convertRequest);
use Aspose\Words\WordsApi;

$wordsApi = new WordsApi('####-####-####-####-####', '##################');

$requestDocument = "Input.md";
$requestTable = new TableInsert(array(
    "columns_count" => 1,
    "rows_count" => 2,
));
$insertTableRequest = new InsertTableOnlineRequest(
    $requestDocument, $requestTable, "", NULL, NULL, NULL, NULL, NULL, NULL
);
$insertTable = $wordsApi->insertTableOnline($insertTableRequest);

$convertRequest = new ConvertDocumentRequest(
    array_key_first($insertTable->document()->values()), "md", NULL, NULL, NULL, NULL
);
$convert = $wordsApi->convertDocument($convertRequest);
use Aspose\Words\WordsApi;

$wordsApi = new WordsApi('####-####-####-####-####', '##################');

$requestDocument = "Input1.md";
$requestDrawingObject = new DrawingObjectInsert(array(
    "height" => 0,
    "left" => 0,
    "top" => 0,
    "width" => 0,
    "relative_horizontal_position" => "Margin",
    "relative_vertical_position" => "Margin",
    "wrap_type" => "Inline",
));
$requestImageFile = "Input2.md";
$insertDrawingObjectRequest = new InsertDrawingObjectOnlineRequest(
    $requestDocument, $requestDrawingObject, $requestImageFile, "sections/0", NULL, 
	   NULL, NULL, NULL, NULL, NULL
);
$insertDrawingObject = $wordsApi->insertDrawingObjectOnline($insertDrawingObjectRequest);

$convertRequest = new ConvertDocumentRequest(
    array_key_first($insertDrawingObject->document()->values()), "md", NULL, NULL, NULL, NULL
);
$convert = $wordsApi->convertDocument($convertRequest);
Kode roto
  
Nyalin kode PHP menyang clipboard

Cara Ngowahi MD ing PHP

  1. Pasang 'Aspose.Words Cloud kanggo PHP'
  2. Tambah referensi perpustakaan (ngimpor perpustakaan) menyang proyek PHP sampeyan
  3. Muat MD kanggo nyunting ing PHP
  4. Lebokake isi ing wiwitan MD
  5. Download dokumen asil saka panyimpenan maya

Pustaka PHP kanggo nggunakake panyuntingan MD.

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 suntingan 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.