|
各位版友好!
代码:
PHP复制代码
class Welcome extends CI_Controller {
/**
* Index Page for this controller.
*
* Maps to the following URL
* http://example.com/index.php/welcome
* - or -
* http://example.com/index.php/welcome/index
* - or -
* Since this controller is set as the default controller in
* config/routes.php, it's displayed at http://example.com/
*
* So any other public methods not prefixed with an underscore will
* map to /index.php/welcome/<method_name>
* @see http://codeigniter.com/user_guide/general/urls.html
*/
function __construct (){
parent ::__construct ();
$this->load->helper('url');
$this->load->helper('form');
}
public function index ()
{
// $this->load->view('index');
$this->load->view('home');
}
public function sinaWburl2ID ($url) {
$surl[2]= str62to10 (substr($url,strlen($url)-4,4));
$surl[1]= str62to10 (substr($url,strlen($url)-8,4));
$surl[0]= str62to10 (substr($url,0,strlen($url)-8));
return $surl[0] . $surl[1] . $surl[2];
}
public function str62to10 ($str62){ //62进制到10进制
$strarry=str_split($str62);
$str=0;
for ($i =0; $i <strlen($str62);$i++) {
$vi=Pow(62, (strlen($str62) - $i - 1));
$str+=$vi*str62keys ($strarry[$i]);
}
return $str;
}
public function str62keys ($ks)//62进制字典
{
$str62keys = array("0", "1", "2", "3", "4", "5", "6", "7", "8", "9","a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z","A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z");
return array_search($ks,$str62keys);
}
public function getCommentByUrl ()
{
$url=$this->input->post('iurl');
$id=sinaWburl2ID ($url);
// $id=3386232065026453;
$data['mid']=$id;
$this->load->view('test',$data);
}
复制代码
我的程序是部署在SAE上面的。
结果一直报错:
SAE_Fatal_error: Call to undefined functionsinaWburl2ID()
我的疑问是:难道controller中的方法,不能互相调用么? |
|