即时尝试编写代码,我可以提交表单输入数据库中的内容,同时执行文件上传并将其存储在我的服务器内的文件夹中
文件夹位置称为上传,位于我的网站的根目录
这是我的代码
控制器(site.php)
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Site extends CI_controller {
public function __construct()
{
parent::__construct();
// Your own constructor code
$this->load->model("site_model");
$this->load->helper(array('form', 'url'));
}
public function cmain($type,$page)
{
$data = $this->_initialize_data(); //this is just a bunch of variables that im calling in another function
$data['type'] = $type;
$data['page'] = $page;
$this->load->vars($data);
$this->load->view('site/cmain');
}
public function m1()
{
$this->load->library('upload', $config);
if(isset($_POST['m1']))
{
$suffix = $this->input->post("suffix");
$fn = $this->input->post("fn");
$mn = $this->input->post("mn");
$ln …Run Code Online (Sandbox Code Playgroud) 我正在尝试编写一个代码,我使用这一特定代码行将我的post值存储在会话数组中
$this->session->set_userdata('newdata', $newdata);
Run Code Online (Sandbox Code Playgroud)
问题是,我似乎无法回应其中的值.
这就是我如何回应它们:
<?php echo $this->session->userdata('suffix'); ?>
Run Code Online (Sandbox Code Playgroud)
是否还有另一种回应会话的方法?
提前致谢!