Greetings im new in laravel and i want to learn how to show the html page in laravel.

My laravel's location is: C:/wamp/www/laravel

The location of the page that i want to view: C:/wamp/www/laravel/app/views/hello.php

I tried localhost/wamp/www/laravel/app/views/hello.php but it only gives me an error:

The requested URL /wamp/www/laravel/app/views/hello.php was not found on this server.

Recommended Answers

All 5 Replies

did you try localhost/laravel/hello

The hello should be defined as route.

For example, if we have a controller as shown below. I did not test this, because I don't have any laravel on my development server at the moment.So, most of the codes below are coming out of my head as I type this response. However, your codes should be pretty similar to this.

hello controller

<?php

    class HelloController extends BaseController{

            public function sayHello(){

                $message = 'hello world';
                return View::make('hello', array('message' => $message));

            } 
     }

the above controller can be routed like this

Route::get('hello', 'HelloController@sayHello');

the route above will allow you to access localhost/laravel/hello

there is another way creating a route in Laravel, but I can't remember them right now.

Still the same error :/.

The requested URL /laravel/hello was not found on this server.

can post your router codes for this page? It should be located in app/routes.php.

Can post your controller for this page?
How about the view file?

MVC is easy to figure out. The uri[1] is always the controller or at least a controller has something to do with it. e.g. localhost/installation_dir/controller_name_OR_router_definition/_controller_method/

By the way, how did you install laravel? Did you use composer?

can you try, localhost/laravel/public to see if you can view the welcome page?

for xampp, you need to change this

filename: laravel/app/config/app.php

look for this code

'url' => 'http://localhost/',

change it to

'url' => 'http://localhost/laravel/',

save your changes and direct your browser to

localhost/laravel/public/

you should be able to view the welcome page

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.