2017-03-27 6 views
0

wie cron in cPanel laufen mit codeigniterwie cron in cPanel laufen codeigniter mit

<?php 

class Cron extends CI_Controller { 

    public function __construct() 
    { 
     parent::__construct(); 

    $this->load->model('customerdata_model'); 

    } 

    public function index() 
    { 

     $c_date = date('Y-m-d'); 
     $remider_data = $this->customerdata_model->get_customer_remider_data(array('status'=>'1', 'reminder_date_before' => $c_date)); 
     foreach($remider_data as $remider_data_mail) 
     { 
        $mailTo = $remider_data_mail->reminder_email; 
        $nameTo = $remider_data_mail->reminder_email; 

        $mailFrom ="[email protected]"; 
        $nameFrom = "Arya project Board"; 

        $subject ="reminder_date_before"; 
        $body  = $remider_data_mail->reminder_description;   

       $headers = "Content-type: text/html;\n"; 
       $headers .= "From: ". $nameFrom . " <" . $mailFrom . ">\n";     
       $headers .= "Reply-To: ". '[email protected]' . " <" . 'Arya Project Board' . ">\n"; 
       $headers .= "Return-Path: " . $mailFrom ."\n"; 

        if(mail($mailTo, $subject, $body, $headers)) 
        { 
         echo 'email sent'; 
        } 
     } 


    } 

} 

Es ist meine Controllers-> Cron-Datei.

Ich verwende Index-Funktion zur Verwendung von Cron-Job.

und ich setzen in cPanel/usr/bin/php /home/*****/public_html/*****/index.php cron Index

und auch PHP/full-Weg, den ich mit -zu-cron-Datei/cron.php/test/Index

+0

Mit was haben Sie ein Problem? Was ist das für eine cron.php Datei? – shaggy

+0

Ich habe Post in Cron. Es hat meinen Index-Seiten-Text gesendet. – KGR

Antwort

0

ich weiß nicht, warum,

php /path/to/the/project/index.php Controller-Funktion

nicht für mich arbeiten, aber das ist für mich tat Arbeit

php/path/to /the/project/index.php Controller/Funktion

Beachten Sie das "/" zwischen Controller und Funktion.