Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static function createLog($cpa = null, $error = null)
- {
- $appDir = \Yii::getAlias('@app');
- $path = $appDir . '/logs';
- $filePath = $path .'/cpa_cron_log' . '.txt';
- if(!file_exists($path)){
- mkdir($path,0666);
- }
- $time = new \DateTime();
- $currentTime = $time->format('Y-m-d H:i:s');
- $log = PHP_EOL . $currentTime . PHP_EOL . $cpa . PHP_EOL . 'error_info: ' . $error . PHP_EOL;
- file_put_contents($filePath, $log, FILE_APPEND | LOCK_EX);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement