8wDlpd.png
8wDFp9.png
8wDEOx.png
8wDMfH.png
8wDKte.png

laravel exel 在 cpanel 中无法正常工作且未显示任何错误

Richard Hansen 2月前

18 0

我的 laravel 10 在 Windows 10、VMware ubuntu 上运行良好。但在 cpanel 中不起作用。cPanel 110.0.39database\seeders\CountryXlsxSeeder.php

我的 laravel 10 在 Windows 10、VMware ubuntu 上运行良好。但在 cpanel 中不起作用。
cPanel 110.0.39

数据库\seeders\CountryXlsxSeeder.php

<?php

namespace Database\Seeders;

use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\Schema;
use App\Models\MasterData\Country;
use Maatwebsite\Excel\Facades\Excel;

class CountryXlsxSeeder extends Seeder
{
    /**
     * Run the database seeds.
     *
     * @return void
     */
    public function run()
    {
        Schema::disableForeignKeyConstraints();
        
        Country::truncate();

        $filename = 'database/sheets/ImportSheets/countries.xlsx';

        if (is_file($filename)) {
            echo "doing CountryImport";
            Excel::import(new \Database\Sheets\ImportClasses\CountryImport, $filename);
        }else{
            echo $filename . ' file not exists';exit;
        }

        Schema::enableForeignKeyConstraints();
    }
}

执行播种机

$ ea-php82 artisan db:seed --class=CountryXlsxSeeder
...

INFO  Seeding database.

doing CountryImport

$_ 

为什么停在这里,并且没有任何错误信息。

裁缝网站/excel 确实存在

$ea-php82 /opt/cpanel/composer/bin/composer 显示网站大小/excel

name     : maatwebsite/excel
descrip. : Supercharged Excel exports and imports in Laravel
keywords : PHPExcel, batch, csv, excel, export, import, laravel, php, phpspreadsheet
versions : * 3.1.56
type     : library
license  : MIT License (MIT) (OSI approved) https://spdx.org/licenses/MIT.html#licenseText
homepage :
source   : [git] https://github.com/SpartnerNL/Laravel-Excel.git 0381d0225b42c3f328d90f0dd05ca071fca3953f
dist     : [zip] https://api.github.com/repos/SpartnerNL/Laravel-Excel/zipball/0381d0225b42c3f328d90f0dd05ca071fca3953f 0381d0225b42c3f328d90f0dd05ca071fca3953f
path     : /home/staus/public_html/laravel/vendor/maatwebsite/excel
names    : maatwebsite/excel

support
issues : https://github.com/SpartnerNL/Laravel-Excel/issues
source : https://github.com/SpartnerNL/Laravel-Excel/tree/3.1.56

autoload
psr-4
Maatwebsite\Excel\ => src/

requires
composer/semver ^3.3
ext-json *
illuminate/support 5.8.*||^6.0||^7.0||^8.0||^9.0||^10.0||^11.0
php ^7.0||^8.0
phpoffice/phpspreadsheet ^1.18
psr/simple-cache ^1.0||^2.0||^3.0

requires (dev)
laravel/scout ^7.0||^8.0||^9.0||^10.0
orchestra/testbench ^6.0||^7.0||^8.0||^9.0
predis/predis ^1.1

国家进口

<?php

namespace Database\Sheets\ImportClasses;

use App\Models\MasterData\Country;
use Maatwebsite\Excel\Concerns\ToModel;
use Maatwebsite\Excel\Concerns\WithStartRow;
use Maatwebsite\Excel\Concerns\WithMultipleSheets;
use Maatwebsite\Excel\Concerns\WithHeadingRow;

class CountryImport implements ToModel,WithStartRow,WithMultipleSheets,WithHeadingRow
{
    public function model(array $row)
    {
        $model = new Country([
            'code'  => $row['code'],
            'name'  => $row['name'],
            'native_name'  => $row['native_name'],
            'iso_code_3'  => $row['iso_code_3'],
        ]);

        return $model;
    }

    public function startRow(): int
    {
        return 2;
    }

    public function sheets(): array
    {
        return [
            'countries' => $this,
        ];
    }
}
帖子版权声明 1、本帖标题:laravel exel 在 cpanel 中无法正常工作且未显示任何错误
    本站网址:http://xjnalaquan.com/
2、本网站的资源部分来源于网络,如有侵权,请联系站长进行删除处理。
3、会员发帖仅代表会员个人观点,并不代表本站赞同其观点和对其真实性负责。
4、本站一律禁止以任何方式发布或转载任何违法的相关信息,访客发现请向站长举报
5、站长邮箱:yeweds@126.com 除非注明,本帖由Richard Hansen在本站《laravel》版块原创发布, 转载请注明出处!
最新回复 (0)
返回
作者最近主题: