search

Home  >  Q&A  >  body text

tp5 route problem

I would like to ask everyone for advice. I have just learned tp5 not long ago. Now I have a route problem. After turning on routing

think\Route::rule('xxx/client/login.php', 'admins.php/admins/Account/login');

In the browser url It can be accessed normally, but an exception is thrown when using httpwebrequest to send a post request: Internal error 500.

What is the cause?

XYXY2161 days ago1215

reply all(3)I'll reply

  • 航航

    航航2019-02-14 10:58:56

    tp5's route.php is used to define routes with get, post, resource and other methods. If the route is correctly defined and the web page can be accessed but the interface tool cannot request it, you can try adding Content-type: application/ in the header. x-www-form-urlencodedRequest

    reply
    0
  • XY

    Web access is normal. After the route takes effect, the original URL will become invalid. request.ContentType = "application/x-www-form-urlencoded"; request.Method = "POST"; request.ServicePoint.Expect100Continue = false; It works fine without routing code, but it reports 500 error when routing is used.

    XY · 2019-02-15 19:04:37
  • Cancelreply