Single Pages dash in url

Permalink
I have a single page within the controller I allow certain urls, but having trouble allowing dashes in those url's.

Example URL's
/custom/example-url <-- Does not work
/custom/example_url <-- Works


The relevant part of the controller is as follows
public function view()
    {
        //View Stuff
    }
    public function example_url()
    {
        //Sub view does not work if the URL has dashes in?
    }


Is it possible to accept dashes in the single page sub view url?

Thanks
Sean

TheRealSean
 
jasteele12 replied on at Permalink Reply
jasteele12
PHP does not allow - (the minus operator) in function names.

If it's that important you would need to handle this with .htaccess rewrite rules, or create another single page at that URL (or a route in 5.7+)
JohntheFish replied on at Permalink Best Answer Reply
JohntheFish
You could have another controller for the function at

/custom/example-url/controller.php

with

function view(){};