我们可以在 Codeigniter 的另一个函数中编写多个函数吗?这是我的控制器
class Products extends CI_Controller {
public function myproduct() {
$this->load->view('myproduct'); // call myproduct.php
public function features() {
$this->load->view('features'); // call "myproduct/features"
}
public function screenshots() {
$this->load->view('screenshots'); // call "myproduct/screenshots"
}
}
}
根据我的控制器,myproduct() 中有 2 个内联函数。我的目标是将网址显示为
localhost/mysite/products/myproduct
localhost/mysite/products/myproduct/features
localhost/mysite/products/myproduct/screenshots
我已经尝试过了,但它给了我一个错误
Parse error: syntax error, unexpected 'public' (T_PUBLIC) in D:\...........\application\controllers\mysite\products.php on line 5
第 5 行是
public function features() { .........