zzz

Like trang page giúp ad nhé! THANK ALL

Thứ Tư, 4 tháng 11, 2015

[Laravel-5]-bài 3: Đường dẫn URL


URL
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1. Lấy đường dẫn hiện tại của trang web
Route::get('a/b', function(){
          return URL:full();
          });
kq: sẽ trả về as : http://localhost:8084/laravel5/public/a/b
2. Tạo  1 URL đến 1 file .
note: tạo đường dẫn đến 1 file .
Route::get('a/b', function(){
   return URL::asset('css/mystyle.css', true); // note: chữ true để nó có dạng https
              });
3. link file css và js vào web
<link rel="stylesheet" href="{{asset('public/template/css/mystyle.css',true)}}">

4. truyền tham số cho URL (sử dụng true nếu là https )
Route::get('url/to, function(){
          return URL::to('tintuc/baivie', ["thamso1", "thamso2"], true);
          });
5. truyền tham số cho URL (cái này chỉ dùng cho https)
Route::get('url/secure, function(){
          return secure_url('tintuc/baiviet', ['thamso1', thamso2'])
});

Không có nhận xét nào:

Đăng nhận xét