i tried create some controllers, models and views with - hyphen, but i get php error always so i am using underscore right now.
so my url is: http://localhost:8888/ci/index.php/get_artist_discography/artist_name
i would like be like that: http://localhost:8888/ci/index.php/get-artist-discography/artist-name
its possible have urls with - hyphen in codeigniter?
my code:
/controllers:
<?php
include (APPPATH.'/libraries/REST_Controller.php');
class get_artist_discography extends REST_Controller {
function artist_name_get(){
$data = new stdClass();
$this->load->model('artist_model');
$data = $this->artist_model->getAll();$this->response($data, 200);
}
}
/models:
<?php
class artist_model extends CI_Model {
function getAll(){
$q = $this->db->query("SELECT artist_discography,artist_name from music");
if($q->num_rows() > 0) {
foreach ($q->result() as $row) {
$data [] = $row;
}
return $data;
}
}
}