我的主控制器中有以下内容
public function chapter-1 () {
$data['title'] = "Hello";
$this->load->view("site_head", $data);
$this->load->view("site_header");
$this->load->view("site_content");
$this->load->view("site_footer");
}
Run Code Online (Sandbox Code Playgroud)
但是当我写"公共功能第一章"时,数字1以橙色亮起,我希望我可以使用第一章到我的网站上获取www.webpage.com/chapter-1.我怎么能完成它?
例如,我有一个这样的类
public function data() {
$a = 1;
$b = 2;
$c = 3;
}
public function codeigniter() {
$a, $b, $b //how i can get the value??
}
Run Code Online (Sandbox Code Playgroud)
我怎样才能获得的价值$a,$b,$c这样我可以在使用它codeigniter()的功能?我用codeigniter?我需要添加return;吗?
我收到此错误帮助!我正在尝试发送电子邮件,但它无法正常工作
$this->email->from('you@example.com', 'Your Name');
$this->email->to($data['email']);
$this->email->subject('This the test');
$this->email->message('this is the test message');
$this->email->send();
if(! $this->email->send()){
echo $this->email->print_debugger();
}
else
{
echo 'send';
}
Run Code Online (Sandbox Code Playgroud)
我收到了这个错误
Cannot send mail with no "From" header.
Run Code Online (Sandbox Code Playgroud) 我检查所有堆栈站点并谷歌它也.但我无法找到适当的解决方案.
有没有想过这个?
问题是数据没有插入购物车.我将控制器数据中的数据回显到控制器中.但是没有插入购物车?
调节器
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Cart extends CI_Controller
{
public function __construct()
{
parent::__construct();
$this->load->library('session');
$this->load->model('Product_Model');
$this->load->library('cart');
}
public function index()
{
}
public function insert_cart()
{
$data = array(
'id' => $this->input->post('id'),
'qty' => $this->input->post('qty'),
'price' => $this->input->post('price'),
'name' => $this->input->post('head'),
);
$cartdata = $this->cart->insert($data);
if(!empty($cartdata)){
print_r($cartdata);
}else{
echo "no data";
}
// $count = $this->cart->contents();
// print_r($count) ;
die();
}
}
Run Code Online (Sandbox Code Playgroud)
在视图ajex数据发送.
<script>
$(function(){
$( "#submit" ).click(function(event) { …Run Code Online (Sandbox Code Playgroud) 我是数据库中CodeIgniter的新用户,密码字段使用加密密钥编码,但是当我想登录时,它与密码不匹配.控制器名称,视图和模型分别是Hello,login和user_model.
这是我的观点:
<html>
<head>
<title></title>
<style>
.text-danger {
color: red;
}
</style>
<script>
function myFun() {
var r4 = document.getElementById('email').value;
var r5 = document.getElementById('password').value;
if (r4 == "") {
document.getElementById('f4').style.display = "block";
return false;
}
else if (r5 == "") {
document.getElementById('f5').style.display = "block";
return false;
}
}
function myFun4(r) {
if (r != 0) {
document.getElementById('f4').style.display = "none";
}
}
function myFun5(r) {
if (r != 0) {
document.getElementById('f5').style.display = "none";
}
}
</script>
</head>
<body style="background-color: …Run Code Online (Sandbox Code Playgroud) 我在foreach循环中有以下条件语句.我希望检查所有条件语句.我希望通过使用switch case语句可以完成它.任何人都可以给我一个想法如何做到这一点?或者还有其他方法吗?有些日期有关于所有四个条件的值.他们不会检查我是否使用此代码.由于我是新手,我很难弄清楚如何做到这一点.如果有人能提出想法,那将是一个很大的帮助.
foreach ($query->result() as $row) {
if ($row->title == 'GK' && $row->type == 'AM') {
$cal_data[substr($row->date_cal, 8, 2)] = '<div class="gk_am">' . $row->title . ' ' . $row->type . '</div>';
} if ($row->title == 'GK' && $row->type == 'PM') {
$cal_data2[substr($row->date_cal, 8, 2)] = '<div class="gk_pm">' . $row->title . ' ' . $row->type . '</div>';
} if ($row->title == 'RP' && $row->type == 'AM') {
$cal_data3[substr($row->date_cal, 8, 2)] = '<div class="rp_am">' . $row->title . ' ' . $row->type . …Run Code Online (Sandbox Code Playgroud) 我想是的,我有一个uniq的ID呼叫NUM我想插入多发说明了这一独特NUM.我有一个动态添加文件的表单,所以我可以添加我想要的字段.当我尝试插入一行数据时,当我尝试插入多个行数据时,它无法正常工作.
我的查看页面:
<form name="codexworld_frm" action="" method="post">
<div class="field_wrapper">
<input type="text" name="num" value=""/><br />
<input type="text" name="description[]" value=""/><input type="text" name="voucher_no[]" value=""/><input type="text" name="price[]" value=""/>
<a href="javascript:void(0);" class="add_button" title="Add field"><img src="<?php echo base_url('images/add-icon.png'); ?>"/></a>
</div>
<input type="submit" name="submit" value="SUBMIT"/>
</form>
Run Code Online (Sandbox Code Playgroud)
我的控制器:
$data = array(
'no' => $this->input->post('num'),
'descriptions' => $this->input->post('description'),
'voucher' => $this->input->post('voucher_no'),
'des_price' => $this->input->post('price'),
);
$this->multi_model->form_insert($data);
$data['message'] = 'Data Inserted Successfully';
//Loading View
$this->load->view('multi_view', $data);
Run Code Online (Sandbox Code Playgroud)
我的型号:
function form_insert($data){
$this->db->insert('tbl_description', $data);
}
Run Code Online (Sandbox Code Playgroud)
如果我使用foreache循环到我的模型我认为它会工作,但我如何使用? …
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Welcome_model extends CI_Model {
public function select(){
$this->db->get('av_home');
echo $this->db->num_rows();
}
}
Run Code Online (Sandbox Code Playgroud)
上面的代码给出错误,
调用未定义的方法CI_DB_mysql_driver :: num_rows()
Fatal error: Maximum execution time of 30 seconds exceeded in D:\wamp\www\moneymanager18_8_15\system\database\drivers\mysqli\mysqli_driver.php on line 221
Run Code Online (Sandbox Code Playgroud)
这在上传期间发生.文件正在上传,但同时此错误显示.
我想做这样的事情
$this->db->count_all("grant_money")->where('id',5);
Run Code Online (Sandbox Code Playgroud)
可能吗 ?
如果还有其他办法,请告诉我.谢谢
我想在单行代码中执行此查询,就像我在上面尝试过的那样