我遇到了由Chris Kacerguis维护的流行的REST API codeigniter的问题,我创建了一个Datadiri控制器,如下所示:
<?php
require (APPPATH.'/libraries/REST_Controller.php');
class Datadiri extends REST_Controller{
function __construct($config = 'rest'){
parent::__construct($config);
}
//tampilkan data
function index(){
$buku = $this->db->get('perpustakaan');
$this->response($buku, 200);
}
}
Run Code Online (Sandbox Code Playgroud)
这是Rest_controller.php https://github.com/chriskacerguis/codeigniter-restserver/blob/master/application/libraries/REST_Controller.php
但是还是一样,找不到错误类“ REST_Controller”。我该如何解决?
致命错误:在第4行的C:\ xampp \ htdocs \ CodeIgniter \ application \ controllers \ datadiri.php中找不到类“ REST_Controller”
严重性:错误
消息:找不到类“ REST_Controller”
文件名:controllers / datadiri.php
行号:4
回溯:
我如何从片段中清除共享偏好?谢谢
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
sharedPreferences = getActivity().getSharedPreferences("login.conf", Context.MODE_PRIVATE);
editor = sharedPreferences.edit();
editor.clear();
editor.commit();
Intent logout = new Intent(getActivity(), LoginActivity.class);
startActivity(logout);
Log.d(TAG, sharedPreferences.getString("username", ""));
Log.d(TAG, sharedPreferences.getString("password", ""));
// Inflate the layout for this fragment
return inflater.inflate(R.layout.fragment_fragment_logout, container, false);
}
Run Code Online (Sandbox Code Playgroud)
那是我的片段