There are mainly 2 issue.
Your Registration.php is placed at wrong place
Currently it is placed at
Vendor/Siteinfo/etc/registration.php
it should be:
Vendor/Siteinfo/registration.php
Wrong Vendor name is defined in registration.php
Wrong Vendor name in module.xml
Please follow below
Create
app/code/Vendor/Siteinfo/registration.php
<?php
\Magento\Framework\Component\ComponentRegistrar::register(
\Magento\Framework\Component\ComponentRegistrar::MODULE,
'Vendor_Siteinfo',
__DIR__
);
app/code/Vendor/Siteinfo/etc/module.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Vendor_Siteinfo" setup_version="1.0.0">
</module>
app/code/Vendor/Siteinfo/Block/Storeinfo.php
<?php
namespace Vendor\Siteinfo\Block;
class Siteinfo extends \Magento\Framework\View\Element\Template
{
public function __construct(
\Magento\Backend\Block\Template\Context $context,
array $data = []
)
{
parent::__construct($context, $data);
}
/**
* Get store identifier
*
* @return int
*/
public function getStoreId()
{
return $this->_storeManager->getStore()->getId();
}
/**
* Get website identifier
*
* @return string|int|null
*/
public function getWebsiteId()
{
return $this->_storeManager->getStore()->getWebsiteId();
}
/**
* Get Store code
*
* @return string
*/
public function getStoreCode()
{
return $this->_storeManager->getStore()->getCode();
}
/**
* Get Store name
*
* @return string
*/
public function getStoreName()
{
return $this->_storeManager->getStore()->getName();
}
/**
* Get current url for store
*
* @param bool|string $fromStore Include/Exclude from_store parameter from URL
* @return string
*/
public function getStoreUrl($fromStore = true)
{
return $this->_storeManager->getStore()->getCurrentUrl($fromStore);
}
/**
* Check if store is active
*
* @return boolean
*/
public function isStoreActive()
{
return $this->_storeManager->getStore()->isActive();
}
}
?>
app/code/Vendor/Siteinfo/view/frontend/templates/storename.phtml
<?php echo $block->getStoreName(); ?>
After that you need to run:
php bin/magento setup:upgrade
php bin/magento cache:flush