H
H
Hfnas2019-08-21 18:39:59
1C-Bitrix
Hfnas, 2019-08-21 18:39:59

Why "Class 'Ras\CVas' not found (0)"?

Good afternoon,
I'm making a module.
created file /local/modules/ras.vas/lib/fvas.php

namespace Ras;

class CFvac
{
    function hello(){
        echo "hello";
    }
}

file /local/modules/ras.vas/include.php
<?
use \Bitrix\Main\Config\Option;
use \Bitrix\Main\ArgumentNullException;

\Bitrix\Main\Loader::registerAutoloadClasses(
    'ras.vas',
    array(
        'CFvac'                => 'lib/fvas.php'));
?>

If in the previous file remove / add
\Bitrix\Main\Loader::registerAutoloadClasses

the result is the same.
The error occurs in the /test.php file
<?
require($_SERVER["DOCUMENT_ROOT"]."/bitrix/header.php");
$APPLICATION->SetTitle("");?><?$APPLICATION->SetTitle("Рейтинг");?> <br>
<?
use Ras/CFvac;
if (CModule::IncludeModule("ras.vas")){
    echo "1"; //выводит, на странице bitrix/admin/partner_modules.php?lang=ru модуль установлен.

CFvac::hello(); //ошибка--Class 'Ras\CVas' not found (0)

}


?>
<br><?require($_SERVER["DOCUMENT_ROOT"]."/bitrix/footer.php");?>

init.php does not exist.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question