小编Alv*_*ack的帖子

Codeigniter购物车无法添加商品

所以我正在尝试使用购物车创建一个应用程序,当我尝试添加该项目时,它无法正常工作.顺便说一句,我已经有一个工作车应用程序,这就是为什么我想知道为什么它不工作.我几乎从工作中复制了所有东西.这是代码

推车控制器

<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Cart extends CI_Controller {

public function __construct()
{
    parent::__construct();
    $this->load->library('cart');
}

public function add_to_cart(){

    $id = $this->uri->segment(3);
    if($this->cart->contents()){
        foreach ($this->cart->contents() as $item){
            if ($item['id']==$id){
                $data = array('rowid'=>$item['rowid'],
                    'qty'=>++$item['qty']);
                $process = $this->cart->update($data);
            }
            else{
                $data = array(
                    'id'=>$id,
                    'qty'=>1,                       
                    'name' => $this->get_data->get_value('product_name','products','product_id', $id),
                    'price' => $this->get_data->get_value('product_price','products','product_id', $id)
                    );
                $process = $this->cart->insert($data);
            }
        }
    }
    else{
        $data = array('id'=>$id,
                    'qty' =>1,
                    'name' => $this->get_data->get_value('product_name','products','product_id', $id),
                    'price' => $this->get_data->get_value('product_price','products','product_id', $id), …
Run Code Online (Sandbox Code Playgroud)

php html5 shopping-cart codeigniter

2
推荐指数
1
解决办法
6139
查看次数

CPanel中的Codeigniter SMTP无法正常工作

我正在使用cpanel,并尝试将电子邮件发送到多封电子邮件。我已经创建了电子邮件帐户并进行了配置,但是当我尝试发送时,存在很多错误。我希望有一个人可以帮助我

?php

 class Notification_model extends CI_Model {

 public function send_notification_email($link){

 $emails = $this->get_all_emails();

 $this->load->helper('email');
 $this->load->library('email');

 $config['protocol']    = 'smtp';
 $config['smtp_host']    = 'lax09.web.com.ph';
 $config['smtp_port']    = '465';
 $config['smtp_auth']    = true;
 $config['smtp_timeout'] = '7';
 $config['smtp_user']    = $this->config->item('admin_email');
 $config['smtp_pass']    = $this->config->item('admin_pass');
 $config['charset']    = 'utf-8';
 $config['newline']    = "\r\n";
 $config['mailtype'] = "html";
 $config['validation'] = TRUE;
 $this->email->initialize($config);


 $this->email->from($this->config->item('admin_email') , 'Sample Sender');
 $this->email->to($emails);
 $this->email->subject('Good day');

 $message = '
       <!DOCTYPE html>
       <html lang="en">';
 $message .= '<p>Hello Everyone,</p>';
 $message .= '<p>We have news for you, just click the link below for …
Run Code Online (Sandbox Code Playgroud)

php email smtp codeigniter

1
推荐指数
1
解决办法
2412
查看次数

标签 统计

codeigniter ×2

php ×2

email ×1

html5 ×1

shopping-cart ×1

smtp ×1