Php Codeigniter:调用另一个函数中的函数并替换它';使用调用的函数创建URL
我有以下示例代码: 控制器Php Codeigniter:调用另一个函数中的函数并替换它';使用调用的函数创建URL,php,codeigniter,Php,Codeigniter,我有以下示例代码: 控制器 public function one() { $this->two(); // url equals localhost/project/index.php?/one } public function two() { // some code.. // url still equals localhost/project/index.php?/one } class Abc extends CI_Model { publi
public function one()
{
$this->two();
// url equals localhost/project/index.php?/one
}
public function two()
{
// some code..
// url still equals localhost/project/index.php?/one
}
class Abc extends CI_Model {
public function one()
{
}
public function two()
{
}
}
我将如何将URL更改为localhost/project/index.php?/two每当我在one()下调用two()?希望此示例将帮助您理解路由概念: 控制器
public function one()
{
$this->two();
// url equals localhost/project/index.php?/one
}
public function two()
{
// some code..
// url still equals localhost/project/index.php?/one
}
class Abc extends CI_Model {
public function one()
{
}
public function two()
{
}
}
配置=>路由
$route['new-first-url'] = 'abc/one';
$route['new-second-url'] = 'abc/two';
在浏览器url中-
方法一=>https://localhost:80/project_name/new-第一个url
对于方法二=>https://localhost:80/project_name/new-第二个url使用codeigniter路由