'why is Blade code getting rendered on the page?

I just started learning Laravel, Installed Laravel 7.6.2, and PHP 7.4.4 Without modifying a single line of code in the entire Laravel project, I try to open the welcome.blade.php, but it doesn't load correctly, the Blade code is displayed on the page as shown in this screenshot. Can anyone help me know the reason for this problem and how to fix it? The next screenshots include the welcome.blade.php code 1, 2, and 3



Solution 1:[1]

How are you accessing blade file ? doesn't seem like you are accessing it via route

Steps:

  1. open terminal/cmd

  2. goto your project directory

  3. run php artisan serve

  4. Open browser and type in http://localhost:8000

After these steps you will see the welcome.blade.php rendered in your browser

Note:

You need xamp / wamp to get apache service on your localhost

Solution 2:[2]

The reason why blade is because .blade.php is the template engine for laravel thus enable it writing of notation @ with if statement

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Akhzar Javed
Solution 2 Wilbroad Mark