บทความ

กำลังแสดงโพสต์จาก พฤษภาคม, 2017

Create a Zip File Using PHP

รูปภาพ
Create a Zip File Using PHP /* creates a compressed zip file */ function create_zip ( $files = array ( ) , $destination = '' , $overwrite = false ) { //if the zip file already exists and overwrite is false, return false if ( file_exists ( $destination ) && ! $overwrite ) { return false ; } //vars $valid_files = array ( ) ; //if files were passed in... if ( is_array ( $files ) ) { //cycle through each file foreach ( $files as $file ) { //make sure the file exists if ( file_exists ( $file ) ) { $valid_files [ ] = $file ; } } } //if we have good files... if ( count ( $valid_files ) ) { //create the archive $zip = new ZipArchive ( ) ; if ( $zip - > open ( $destination , $overwrite ? ZIPARCHIVE :: OVERWRITE : ZIPARCHIVE :: CREATE ) !== true ) { return false ; } //add the files foreach ( $valid_files as $file ) { $zip - > addFile ( $file , $file ) ; } ...

How to change app icon in phonegap application

รูปภาพ
How to change app icon in phonegap application  cordova or phonegap application has default cordova logo as its icon. we need to change it to our custom icon. for that we need to edit our projects  config.xml  file.  config.xml  file can be found in our project directory below www folder cordova config file location Default Icon Default cordova icon Step 1  : First create or make one icon with in 512×512 resolution and it should be in .png format. Step 2 :  create a folder in your project directory with name as  res Step 3 :  Add the icon image in res folder Step 4 :  Open  config.xml  in any editor and add the below line of code <icon src=”res/icon.png”/> Step 3 :  Build the project again in your app you will see your custom icon Credit : http://phonegaptut.com

แปลงตัวเลขให้เป็นตัวเลขภาษาอาหรับ

แปลงตัวเลขให้เป็นตัวเลขภาษาอาหรับ <?php /**  * Converts numbers in string from western to eastern Arabic numerals.  *  * @param  string $str Arbitrary text  * @return string Text with western Arabic numerals converted into eastern Arabic numerals.  */ function arabic_w2e($str) { $arabic_eastern = array('٠', '١', '٢', '٣', '٤', '٥', '٦', '٧', '٨', '٩'); $arabic_western = array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9'); return str_replace($arabic_western, $arabic_eastern, $str); } /**  * Converts numbers from eastern to western Arabic numerals.  *  * @param  string $str Arbitrary text  * @return string Text with eastern Arabic numerals converted into western Arabic numerals.  */ function arabic_e2w($str) { $arabic_eastern = array('٠', '١', '٢', '٣', ...

Using the HTML5 History API

รูปภาพ
The HTML5 History API gives developers the ability to modify a website's URL without a full page refresh. This is particularly useful for loading portions of a page with JavaScript, such that the content is significantly different and warrants a new URL. Here's an example. Let's say a person navigates from the homepage of a site to the Help page. We're loading the content of that Help page with Ajax. That user then heads off to the Products page which we again load and swap out content with Ajax. Then they want to share the URL. With the History API, we could have been changing the URL of the page right along with the user as they navigate, so the URL they see (and thus share or save) is relevant and correct. # The Basics To check out the features of this API it's as simple as heading into the Developer Tools and typing  history  into the console. If the API is supported in your browser of choice then we'll find a host of methods attached to this object...