When I enter domen/cart/add/2379 in the url, it gives an error

 '405 METHOD NOT ALLOWED. THIS URL CAN ONLY HANDLE THE FOLLOWING REQUEST METHODS: POST.', 

the product is added to the cart if you click on the купить button, and if you type the error in the url ... framework yii2 . Tell me where to look)

  • one
    Apparently the call to this method is available using the POST method, and you request using GET . POST - a request to simply form using the forms that you most likely is happening, and the button you apparently submit . A simple way to generate a POST request using the address bar will not work. - Denis Bubnov
  • Yes, this is true) and yet .. where is it possible and how to change this method on the button, I am looking for and can’t find anything - Oleg Artyukh
  • Why change? This is non-kosher and insecure. - user207618

1 answer 1

There was a similar problem: I needed to regenerate a large table with data, and I safely put everything in the transaction. When I tried to run the code, 405 also crashed. The solution is to see the debugger (if any). In my case, I used an incorrect ActiveRecord class that referred to a completely different table.

Update: the error is implicit, and in the case of working with transactions, it can crash to any school for which the transaction failed.

My advice: run your code out of the transaction first, if everything is good, then enter it inside. It may seem trivial, but I'm with almost the same code in 1 of 3 methods on a data pool so well, just ****