전 클래스라는 의견이 있고 난 3 __construct, 인덱스라는 기능과 getComments이 내부CodeIgniter의 라우팅 지수
내 루트 폴더에 또한Class comment extends CI_Controller
{
public function __construct(){
parent::__construct();
}
public function index($comment_id){
echo $comment_id;
}
public function getComments(){
//do stuff to get comments and print them to screen
}
}
내가 새로운 경로
그래서$route['comment/(:any)'] = "comment/index/$1";
을 추가 한 내가
그것을 에코코멘트 ID BU를 mysite.com/comment/123131313123에 갈 때 내가 같은 클래스 실 거예요 작업에 getComments에 아약스() 함수를 호출 할 때 t은 대신 나에게 단어 "getComments는"
어떻게 내가 인덱스에 직접 갈 때 있는지 확인 수를 표시합니다 함수는 저에게 매개 변수를 보여줄 것이며 다른 함수들과 함께 다른 문제없이 아약스 호출을 할 수있을 것입니다.
감사합니다.
어떻게 ajax 통화를하고 있습니까? 사용중인 URL은 무엇입니까? – Matthew
메신저 사용 myscom.com/comment/getComments - 나는 PHP 코드를 추가하지 않았습니다. 왜냐하면 내가 인덱스와 경로를 제거하면 모든 Ajax 호출이 잘 작동합니다. – fxuser