ลองนี่หรือมิฉะนั้นโพสต์รหัสของคุณจากนั้นเราจะแนะนำคุณที่คุณผิดพลาด
บล็อกไฟล์
<?php
namespace Learning\SmartSearch\Block;
class SmartSearch extends \Magento\Framework\View\Element\Template
{
    public function getTitle()
    {
        return "Smart Search";
    }
}
etc / module.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Module/etc/module.xsd">
    <module name="Learning_SmartSearch" setup_version="1.0.0">
    </module>
</config>
ดู / รูปแบบ / cms_index_index.xml
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column" xsi:noNamespaceSchemaLocation="../../../../../../../lib/internal/Magento/Framework/View/Layout/etc/page_configuration.xsd">
    <body>
        <referenceContainer name="content">
            <block class="Learning\SmartSearch\Block\SmartSearch" template="Learning_SmartSearch::html/cms.phtml"/>
        </referenceContainer>
    </body>
</page>
ดู / แม่ / html / cms.phtml
<h1><?php echo $block->getTitle(); ?></h1>
หลังจากสร้างแคชล้าง
ฉันหวังว่านี่จะช่วยคุณได้ หากคุณไม่ได้รับผลลัพธ์แจ้งให้เราทราบ