当开启页面缓存的时候,读取
Magento\Catalog\Model\Session
session的时候会出现null,
解决办法 在view/frontend/layout/ 下面的 xml 中的block 设置
cacheable="false"
<block class="Maijindou\RegisterSerial\Block\Serial" name="customer.register.lists" template="Maijindou_RegisterSerial::lists.phtml" cacheable="false"/>