export to epub format in php

前端 未结 2 801
广开言路
广开言路 2021-01-31 11:24

Does anyone know of a php class that can create/export ePub files?

I have a book stored in a mysql database and I wish to publish it as an ePub format book?

It\'

2条回答
  •  清歌不尽
    2021-01-31 11:48

    Epub is just an archive, like zip or tar. If you want to create an epub file with php from scratch, you have to create separate html-files and a few xml-files with the correct information. Then you should combine them in an archive, it's actually just a zip-archive. It's a little bit work, but it's not very difficult to do with php.

    Creating a zip: http://davidwalsh.name/create-zip-php

    For XML, it's the simplest to create just the tags you need, it's simple to build it with the correct output.

    So:

    1) Create html and xml-files and save them temporarily on your server.

    2) Create a zip archive with the correct files on your server.

    3) Let the user download the archive with the extension .epub.

    Good luck!

提交回复
热议问题