【解決方法】非推奨: __autoload() は非推奨です。代わりに C:\xampp\htdocs\components\autoload.php の 6 行目で spl_autoload_register() を使用してください。

プログラミングQA

[ad_1]

Hi, I am trying to design a website using php and phpmyadmin. This website is supposed to open without difficulty. The following code is part of the execution process of the project, I have errors in lines 6.
Deprecated: __autoload() is deprecated, use spl_autoload_register() instead in C:\xampp\htdocs\components\Autoload.php on line 6
What is causing these issues and what do I need to do to resolve them?

here the code i have:
<?php

/**
 * Функция __autoload для автоматического подключения классов
 */
function __autoload($class_name)

{

    $array_paths = array(
        '/controllers/',
        '/models/',
        '/components/',
    );

    foreach ($array_paths as $path) 
    {
        // Формируем имя и путь к файлу с классом
        $path = ROOT . $path . $class_name . '.php';

        // Если такой файл существует, подключаем его
        if (file_exists($path)) require_once($path);

    }
}

私が試したこと:

PHP books, Online websites, youtube and consulting fellow colleagues.

解決策 1

エラー メッセージを読んでください。それは非常に明確です。

エラー
Deprecated: __autoload() is deprecated, use spl_autoload_register() instead

それを修正するために何をする必要があるのか​​も正確に教えてくれます。

[ad_2]

コメント

タイトルとURLをコピーしました