php

How to install Laravel globally in Ubuntu

 =================================================================== Open your terminal using Ctrl+Alt+T and type the following commands Step 1: Install Laravel composer global require “laravel/installer” Step 2: Add composer to path to access laravel globally export PATH=”~/.config/composer/vendor/bin:$PATH” Step 3: Create a new Laravel application laravel new blog Step 4: Install missing packages and their dependencies cd blogcomposer install Step 5: Test the application …

How to install Laravel globally in Ubuntu Read More »

Update particular key and its value in wp_option table in wordpress

//first get all the value by get option   $saved_lisc_data = get_option( ‘lisc_settings’); //then put the update the key and its value $saved_lisc_data[‘lisc_match_status’] = ‘complete’; //then update the option update_option( ‘lisc_settings’ , $saved_lisc_data); //for multiple value update $lisc_updated_data = get_option( ‘lisc_settings’); $lisc_updated_data[‘lisc_enable_status’] = $lisc_enable_status; $lisc_updated_data[‘lisc_api_url’] = $_POST[‘lisc_api_url’]; $lisc_updated_data[‘lisc_interval’] = $_POST[‘lisc_interval’]; $lisc_updated_data[‘lisc_total_timing’] = $_POST[‘lisc_total_timing’]; update_option( ‘lisc_settings’ , …

Update particular key and its value in wp_option table in wordpress Read More »

php directory listing

<?php // you can add to the array $ext_array = array(“.htm”, “.php”, “.asp”, “.js” ,“.css”); //list of extensions not required $dir1 = “.”; $filecount1 = 0; $d1 = dir($dir1); while ($f1 = $d1->read()) { $fext = substr($f1,strrpos($f1,“.”)); //gets the file extension if (in_array($fext, $ext_array)) { //check for file extension in list continue; }else{ if(($f1!= ‘.’) …

php directory listing Read More »

Create log file in php

  function wh_log($log_msg) {     date_default_timezone_set(‘Asia/Kolkata’); $log_filename = $_SERVER[‘DOCUMENT_ROOT’].“/log”; if (!file_exists($log_filename)) { // create directory/folder uploads. mkdir($log_filename, 0777, true); } $log_file_data = $log_filename.‘/log_’ . date(‘d-M-Y’) . ‘.log’; $log_msg = date(‘d-M-Y g:i a’).“–“.$log_msg; file_put_contents($log_file_data, $log_msg . “n“, FILE_APPEND); } wh_log(‘This is a log message’); mkdir( __DIR__ . ‘/logs/’, 0755, true ); $date = date(‘Y-m-d’); $datetime = …

Create log file in php Read More »