Reputation:
I am writing,
<?php echo public_path();?>
It returns results with backlashes instead of forward slashes. I expected forward slashes.
Upvotes: 6
Views: 4386
Reputation: 163748
public_path()
uses DIRECTORY_SEPARATOR
which depends on your OS. To change it to backslashes, you can use str_replace()
:
str_replace('\\', '/', public_path())
Update
For loading assets, use the assets()
helper.
Upvotes: 5