douque9815 2017-01-16 09:54
浏览 220

mPDF:与它们的类同名的方法将不是PHP的未来版本中的构造函数; mPDF有一个不推荐使用的构造函数

I'm new to mpdf and I'm having a problem implementing it on my project. I saw a link in Facebook that has a tutorial for mpdf, I read and followed all the instructions but unfortunately there is still an error about some deprecated value.

Here is the link I followed : http://codesquery.com/convert-html-pdf-codeiniter-using-mpdf/

And here is the screenshot of the problem:

enter image description here

I hope you guys can help me.

  • 写回答

2条回答 默认 最新

  • dongmanni6916 2017-01-16 10:45
    关注

    You can easily install mpdf by using composer in codeigniter. This is how I implemented composer in CodeIgniter 3.It is very easy. You have to install composer on your machine download it from https://getcomposer.org/. After installing composer in your pc,

    1. Copy and paste composer.json file in the project folder to application folder.
    2. In the config.php file $config['composer_autoload'] = TRUE;

    Now you have composer in your project. Now i will saw you how to install mpdf using composer

    1. Open cmd and direct to application folder
    2. Inside application directory Type composer require mpdf/mpdf

    Now a vendor folder will be created inside application folder and inside vendor folder you can see all your packages downloaded by composer.

    Now since you autoloaded composer now you can just use the code given by mpdf official manual like in your controllers.

        function m_pdf(){ 
    
           $mpdf = new mPDF();
    
           // Write some HTML code:
    
           $mpdf->WriteHTML('Hello World');
    
           // Output a PDF file directly to the browser
           $mpdf->Output();
       }
    

    Remember you don't need to type require_once APPPATH.'/vendor/mpdf/mpdf/mpdf.php'; since you already autoloader composer. If not prefer to autoload composer you must type require_once APPPATH.'/vendor/mpdf/mpdf/mpdf.php' at the beginning of each controllers where you use the mpdf vendor libraries. If you encountered any problems please comment below.

    评论

报告相同问题?

悬赏问题

  • ¥15 使用ue5插件narrative时如何切换关卡也保存叙事任务记录
  • ¥20 软件测试决策法疑问求解答
  • ¥15 win11 23H2删除推荐的项目,支持注册表等
  • ¥15 matlab 用yalmip搭建模型,cplex求解,线性化处理的方法
  • ¥15 qt6.6.3 基于百度云的语音识别 不会改
  • ¥15 关于#目标检测#的问题:大概就是类似后台自动检测某下架商品的库存,在他监测到该商品上架并且可以购买的瞬间点击立即购买下单
  • ¥15 神经网络怎么把隐含层变量融合到损失函数中?
  • ¥15 lingo18勾选global solver求解使用的算法
  • ¥15 全部备份安卓app数据包括密码,可以复制到另一手机上运行
  • ¥20 测距传感器数据手册i2c