简体   繁体   中英

How to execute external PHP script using Laravel Commands?

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?

You could simple call

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM