PHP implementation file force download code

/** * PHP Mandatory download file * edit:bbs.it-home.org */ $file _dir = "./"; $name = "Test.txt"; $file = fopen ($file _dir. $name, "R"); Header ("Content-type:application/octet-stream"); Header

PHP reduced PNG image without loss of transparent color instance code

Imagecolorallocatealpha//Assign color + Alpha Imagesavealpha//Set to save full alpha channel information when saving PNG images Copy CodeFull code: Get source map GD image identifier

PHP upload file size limit modification

File_uploads = on; open File upload option upload_max_filesize = 500M; upload file limit Copy CodeIf you want to upload larger files, only the above two are not enough, you also need to increase the server cache limit, the maximum

PHP force download code for PDF files

Forcedownload ("Pdfdemo.pdf"); function Forcedownload ($filename) { if (false = = File_exists ($filename)) { return false; } HTTP headers Header (' content-type:application-x/force-download '); Header

A brief analysis of PHP mandatory download file method

$filename = "Test.txt"; Header ("Content-type:application/force-download"); Header (' Content-disposition:attachment;filename= '. $filename. ' '); ReadFile ($filename); Copy CodeThis enables the file to be downloaded directly

installation procedure of PHP GD library under Linux

Tar xzvf zlib-1.2.3.tar.gz CD zlib-1.2.3 ./configure Make Make install Copy Code2, Installation FreeType Tar xzvf freetype-2.2.1.tar.gz CD freetype-2.2.1 ./configure

function of PHP array character set encoding conversion

/** * Array transcoding * @param array $array arrays for transcoding * @param String $inCharset Original code * @param String $outCharset the converted Encoding * @return $array converted Array * @site:

PHP Implementation Timeline function (just, 5 minutes ago)

function Trantime ($time) { $rtime = Date ("m-d h:i", $time); $htime = Date ("H:i", $time); $time = Time ()-$time; if ($time $str = ' just '; } ElseIf ($time $min = Floor

PHP Flashchart Column Chart Generation example

URL form function Embswfwithurl (Dataurl,divcon) { var params = { "Wmode": "Transparent", "Menu": "false", "Scale": "Noscale", "allowFullScreen": "false", "allowScriptAccess": "Always",

Why so many people learn PHP will choose Brother Lian

There is a kind of person in the world who seems to have a special preference for God-he always has his own ideals, and always tries to do it, and most importantly, God will help him succeed every time. Isn't it admirable? In fact, I always thought,

PHP Histogram generation code (Imagefilledrectugle function Example)

/** * PHP histogram imagefilledrectugle function use case * by bbs.it-home.org */ function CreateImage ($data, $twidth, $tspace, $height) { Header ("Content-type:image/jpeg"); $dataname = Array (); $datavalue =

php5.4 the following simulated getimagesizefromstring function

if ($in = fopen (' Php://input ', "RB")) while ($buff = Fread ($in, 4096)) Fwrite (' e:\\1.jpg ', $buff); Copy CodeTo get the picture information, only getimagesize ($filename), and then hit the file just closed. PHP

Sample code for PHP to export a style Excel file

/** * Exporting Excel with Styles * edit:bbs.it-home.org */ Include ' writer.php '; /* * * * * ready to export Data * * * * $head = ' one Week Schedule '; $data = Array (' Monday ' = = Array (' time ' = ' ~ ',

PHP installation Xdebug, pear/phpunit the text of the detailed

zend_extension= "F:\php_dev\php\ext\php_xdebug-2.2.1-5.4-vc9.dll" [Xdebug] Xdebug.auto_trace=on Xdebug.collect_params=on Xdebug.collect_return=on Xdebug.profiler_enable=on Xdebug.trace_output_dir= "F:\php_dev\temp"

Sample code for PHP analog post submission

/** * PHP in the Curl analog post submission * by bbs.it-home.org */ $url = ' http://website/a.php '; $fields = Array ( ' UserName ' =>urlencode (' a '), ' PWD ' =>urlencode (' B '), ' Appreturn ' =>urlencode (

Code examples for PHP to prevent SQL injection

Function Inject_check ($sql _str) { Return eregi (' select|insert|and|or|update|delete|\ ' |\/\*|\*|\.\.\/|\.\/|union|into|load_file|outfile ', $sql _str) ; } if (Inject_check ($_server[' query_string ')) ==1 or Inject_check

PHP Custom Array function Array_column

if (!function_exists (' Array_column ')) { function Array_column ($input, $columnKey, $indexKey =null) { $columnKeyIsNumber = (Is_numeric ($columnKey))? True:false; $indexKeyIsNull = (Is_null ($indexKey))? True:false;

PHP sprintf function usage php floating-point number format

sprintf ("%9.3f", 3.1415926); Right alignment: The number of digits is not sufficient to complete the space. Result: "3.142" sprintf ("%-9.3f", 3.1415926); Left-justified: the number of digits is not sufficient to fill with blanks. Result: "3.1

PHP FileSystem file System function usage

$path = "/home/httpd/phpha.com/index.php"; Echo basename ($path); Echo basename ($path, '. php '); Echo basename ($path, '. xxx '); echo dirname ($path); ?> Results: index.php Index

PHP header function File download direct prompt to save

$filename = ' path + actual filename '; Types of files Header (' content-type:application/pdf '); Download the displayed name Header (' content-disposition:attachment; filename= ' file name when saving. pdf "');

Total Pages: 5208 1 .... 2655 2656 2657 2658 2659 .... 5208 Go to: GO

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.