How to setup a single route with optional argument |
(12-13-2023, 10:51 PM)ozornick Wrote: Why is the two route option not suitable for you? It's 100% working. You need to determine the required parameter based on the request It's not that the solutions presented don't work for me. My problem is solved, thanks to you! My question is that the implementation does not comply with the documentation. From the docs: Quote:With regular expressions, you can also catch a segment containing a forward slash (/), which would usually represent the delimiter between multiple segments. PHP Code: <?php But that's not the case, unless you rely on variable-length argument lists, i.e., multiple arguments. Maybe we need to add this info/tip to the docs (or your example using "..."), otherwise that '$1' could lead the user to use only one method argument thinking one could catch all segments containing a forward slash in this single variable. It's just a suggestion since I find it very hard to figure it out that we had to use variable-length arguments. |
Welcome Guest, Not a member yet? Register Sign In |