Magento 2 Block 模板在本地工作,不在服务器上

Magento 2 Block template is working locally and doen't on server

我是 Magento 的新手,我创建了一个新页面来列出一些来自 API 的数据,我使用了基于 phtml 模板的 Block 并传递了从 API 到块列出它。这段代码在本地运行良好,但是当我将它部署到服务器时它崩溃了,请帮助我。

这是我的代码

Constroller/Adminhtml/PickupRequest/Index.php

public function execute()
    {
        $resultPage = $this->resultPageFactory->create();
        $resultPage->setActiveMenu(static::MENU_ID);
        $resultPage->getConfig()->getTitle()->prepend(__('Pickup Requests'));
        $data = array();
        $block = $resultPage->getLayout()->getBlock('pickup_request_listing');
        try {
            $sessionClient = $this->authService->authenticate();
            $data = $this->_pickupRequestClient->getPickupRequests($sessionClient);
            $block->setData('pickupRequests', $data);
            $resultPage->getLayout()->addBlock($block);
        } catch (\Exception $e) {
            $this->_logger->err($e->getMessage());
            $this->_logger->err($e->getTraceAsString());
        }
        return $resultPage;
    }

View/adminhtml/layout/companyshipping_pickuprequest_index.xml

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <referenceBlock name="page.title">
        <action method="setPageTitle">
            <argument name="title" xsi:type="string">Demande de ramassage</argument>
        </action>
    </referenceBlock>
    <body>
        <referenceContainer name="content">
            <block name="pickup_request_listing" class="Magento\Backend\Block\Template" template="Company_CompanyShipping::pickuprequest.phtml"/>
        </referenceContainer>
    </body>
</page>

View/adminhtml/templates/pickuprequests.phtml


use Magento\Framework\View\Element\Template;

/** @var Template $block */
?>
<?php
$count = 0;
$pickupRequests = $block->getData('pickupRequests');
?>
<div>
    <table class="data-grid data-grid-draggable">
        <thead>
        <tr>
            <th class="data-grid-th">Refrence</th>
            <th class="data-grid-th">Customer</th>
            <th class="data-grid-th">Package count</th>
            <th class="data-grid-th">Created On</th>
            <th class="data-grid-th">Picked up on</th>
            <th class="data-grid-th">Status</th>
        </tr>
        </thead>
        <tbody>
        <?php
        if (isset($pickupRequests) && $pickupRequests != null && count($pickupRequests) > 0) {
            foreach ($pickupRequests as $pickupRequest) { ?>
                <tr class="data-row <?= $count % 2 == 0 ? '_odd-row' : '' ?>">
                    <td>
                        <div class="data-grid-cell-content"><?= $pickupRequest["name"]; ?></div>
                    </td>
                    <td>
                        <div class="data-grid-cell-content"><?= $pickupRequest["customer"]; ?></div>
                    </td>
                    <td>
                        <div class="data-grid-cell-content"><?= $pickupRequest["count"]; ?></div>
                    </td>
                    <td>
                        <div
                            class="data-grid-cell-content"><?= date("d/m/Y", strtotime($pickupRequest["createdOn"])); ?></div>
                    </td>
                    <td>
                        <div
                            class="data-grid-cell-content"><?php
                            if (isset($pickupRequest["pickedUpAt"])) {
                                echo date("d/m/Y", strtotime($pickupRequest["pickedUpAt"]));
                            }
                            ?></div>
                    </td>
                    <td>
                        <button class="<?= getStatusClass($pickupRequest["status"]); ?>"><?= getStatusLabel($pickupRequest["status"]); ?></button>
                    </td>
                </tr>
                <?php $count++; ?>
            <?php }
        } else { ?>
            <tr class="data-row">
                <td colspan="100">Aucun résultat trouvé..</td>
            </tr>
        <?php } ?>
        </tbody>
    </table>
</div>

大家好,我发现了问题, 当我使用 windows 时,它不会导致问题,因为 windows 对密钥不敏感,另一方面,服务器是 linux 对密钥敏感的机器 所以当我使用带有大写 V 的 View/adminhtml/templates/pickuprequests.phtml 时,它找不到调用的模板,也不会触发任何错误。

我所要做的就是将视图更改为视图,一切都运行良好。