New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
A "1" ends up in the rendered markup when using this router #618
Comments
I've been getting this as well, any chance you were able to figure out the issue? |
@DeveloperMarius Do you have any insight in this? I'm using |
I managed to fixit by adding an exit after requesting a file, the problem is that the return is printed. return require 'login.html'; to require 'login.html';
exit; |
That's because the default behavior of the router is to render multiple routes until an output is returned. In your case, you can disable this feature, then you don't need to use the Set the Router::router()->setRenderMultipleRoutes(false)->start(); I think that should work. If not then you can always just return true. |
I have a simple PHP site I was modernizing (mostly just to see if I could). I found this routing library that seemed good and I wanted to replace the one I wrote because this one seemed better. However, when I added it in, everything routed correctly, but I got the number "1" appearing in the markup of every page, just before the end of the body tag. When I switched back to my custom router it went away.
Here is the source code to the project in question.
src/routes.php
contains the routes,public/index.php
is the main index file. Also I was usingphp -S 0.0.0.0:80 -t public/
to serve the app in development if that's important (didn't want to have to set up a whole Apache/Nginx server in docker in order to develop the app. Reconsidering that lately but this should probably work correctly with PHP's built-in server regardless).The text was updated successfully, but these errors were encountered: