douyaju4749 2019-04-29 10:52
浏览 691

如何使用Laravel命令执行外部PHP脚本?

I have created several php scripts (not Laravel) and I put it inside the app/cli folder of my Laravel project. Inside cli folder I have php files like:

  • fileConverter.php
    • fileUploader.php
    • fileDownloader.php

Now I have created an artisan command that will be executed by php artisan runFileManager line.

My problem is, how to execute those scripts inside the handle() function

public function handle()
    {
        // How to execute external php files here?
    }

of my command class?

  • 写回答

1条回答 默认 最新

  • doujiao7679 2019-04-29 11:58
    关注

    You could simple call

    include base_path('app/cli/fileConverter.php');
    

    Just make sure your file/s [fileConverter.php,..etc] are self dependent

    评论

报告相同问题?

悬赏问题

  • ¥15 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线
  • ¥15 谁有desed数据集呀
  • ¥20 手写数字识别运行c仿真时,程序报错错误代码sim211-100
  • ¥15 关于#hadoop#的问题
  • ¥15 (标签-Python|关键词-socket)
  • ¥15 keil里为什么main.c定义的函数在it.c调用不了
  • ¥50 切换TabTip键盘的输入法
  • ¥15 可否在不同线程中调用封装数据库操作的类
  • ¥15 微带串馈天线阵列每个阵元宽度计算
  • ¥15 keil的map文件中Image component sizes各项意思