📜  laravel 发送 ajax - PHP 代码示例

📅  最后修改于: 2022-03-11 14:54:51.132000             🧑  作者: Mango

代码示例1
// sending ajax from view to controller



// controller
class Controller_name extends Controller {
    function name(Request $request) {
          $post = $request->input();    
          header('Content-Type: Application/json');
          echo json_encode($post);
    }
}

// web.php
route::any('/ajax_request_url', '\App\Http\Controllers\Controller_name@name');