Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update ClassLoader.php #8420

Closed
wants to merge 1 commit into from

Conversation

@AlexRill
Copy link

AlexRill commented Nov 8, 2019

Sorry, i don't speak english, watch examples.

Example 1:
Autoload file:

spl_autoload_register(
function ($classname) {
include DIR . '/' . str_replace('\', '/', $classname) . '.php';
}
);

application file:

use App;
require 'autoload.php';
$app = new App;

This example don't worked.

Example 2:
Autoload file:

spl_autoload_register(
function ($classname) {
require DIR . '/' . str_replace('\', '/', $classname) . '.php';
}
);

application file:

use App;
require 'autoload.php';
$app = new App;

This example worked!

include vs require. Require - worked, include - don't worked.

Sorry, i don't speak english, watch examples.

Example #1:
Autoload file:
<?php
spl_autoload_register(
    function ($classname) {
        include __DIR__ . '/' . str_replace('\\', '/', $classname) . '.php';
    }
);
?>
application file:
<?php
use App;
require 'autoload.php';
$app = new App;
?>

This example don't worked.

Example #2:
Autoload file:
<?php
spl_autoload_register(
    function ($classname) {
        require __DIR__ . '/' . str_replace('\\', '/', $classname) . '.php';
    }
);
?>
application file:
<?php
use App;
require 'autoload.php';
$app = new App;
?>

This example worked!

include vs require. Require - worked, include - don't worked.
@Seldaek

This comment has been minimized.

Copy link
Member

Seldaek commented Nov 8, 2019

Sorry but without more explanation as to why this is needed, I don't think we can accept this change.

Use google translate or something if needed, but we need more infos. The examples make no sense to me.

@alcohol alcohol closed this Nov 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.