2008/07/01 10:21
php
fwrite
(PHP 3, PHP 4 )
fwrite -- Binary-safe file writeDescription
int fwrite ( int fp, string string [, int length])fwrite() writes the contents of string to the file stream pointed to by fp. If the length argument is given, writing will stop after length bytes have been written or the end of string is reached, whichever comes first.
fwrite() returns the number of bytes written, or -1 on error.
Note that if the length argument is given, then the magic_quotes_runtime configuration option will be ignored and no slashes will be stripped from string.
Note: On systems which differentiate between binary and text files (i.e. Windows) the file must be opened with 'b' included in fopen() mode parameter.
파일에 글 내용을 저정할 수 있는 함수이다.
fclose,fopen,fwrite 이 세가지 함수를 가지고 무엇을 할 수 있을지는 고민해 보자.
$dir = fopen($path,"w");
fwrite($dir,"
<?
$G_COMPANY_NAME = '$G_COMPANY_NAME';
$G_COMAPNY_TEL = '$G_COMAPNY_TEL';
$G_SHOP_CODE = '$G_SHOP_CODE';
$G_SHOP_NAME = '$G_SHOP_NAME';
$G_SHOP_DOMAIN = '$G_SHOP_DOMAIN';
$G_SHOP_DOMAIN_IMAGE = '$G_SHOP_DOMAIN_IMAGE';
$G_SHOP_TEL = '$G_SHOP_TEL';
$G_SHOP_TITLE = '$G_SHOP_TITLE';
$G_FREE_DLV_FEE_LIMIT = '$G_FREE_DLV_FEE_LIMIT';
$G_DLV_FEE = '$G_DLV_FEE';
?>
");
fclose($dir);
파일 경로를 맞추고 해보자..
파일이 생성된다..신기하다.
'php' 카테고리의 다른 글
| readdir() -> 파일관리 함수 5 (0) | 2008/07/01 |
|---|---|
| opendir() -> 파일관리 함수 4 (0) | 2008/07/01 |
| fwrite() ->파일생성 함수 (0) | 2008/07/01 |
| fclose() -> php 파일관리 함수 2 (0) | 2008/07/01 |
| fopen() -> php 파일관리 함수 1 (0) | 2008/07/01 |
| explode (0) | 2008/06/30 |
TAG
PHP

