namespace Org\Pay; class BtcPay{ const API='https://api.btcchina.com/api.php/payment'; //支付网关 const NOTIFYURL ='http://www.xxx.com/notify.html'; const CALLBACKURL ='http://www.xxx.com/callback.html'; const ACCESSKEY=''; // const SECRETKEY=''; /*其他参数*/ public function __construct(){ /*其他参数初始化*/ } /** * 商户自己创建订单 */ public function order(){ /** * 创建订单流程 */ $order_id='ORDER_ID'; //订单号 //$param['price']=''; //상품 가격 //$param['currency']='CNY'; //통화 종류 //$param[' notificationURL' ]=self::NOTIFYURL; //https 안전 모드 //$param['returnURL']=self::CALLBACKURL; //$param['externalKey']=$order_id; 이 쇼핑 주문의 외부 키는 고유해야 합니다. //$param['itemDesc']='' //주문 설명 //$param['phoneNumber']=' ' ; //고객 휴대폰 번호 //$param['settlementType']=0;
데이터베이스에 이메일 주소를 추가하는 것은 일반적입니다. 이메일 주소를 추가하기 전에 확인해야 하는 경우가 종종 있습니다.
배열 정렬은 개발 중에 자주 발생합니다. 페이징할 때 일반적으로 데이터베이스에서 데이터를 가져와서 페이지 순회 중에 표시할 배열에 넣습니다. 이때 이 클래스 라이브러리를 통해 원하는 대로 정렬할 수 있습니다. 유용합니다.
실제 개발에서는 많은 데이터 형식을 사용해야 합니다. 배열도 매우 일반적인 형식입니다. 물론 배열 병합은 시간이 많이 소요됩니다.
<?php function Convert_GCJ02_To_BD09($lat,$lng){ $x_pi = 3.14159265358979324 * 3000.0 / 180.0; $x = $lng; $y = $lat; $z =sqrt($x * $x + $y * $y) + 0.00002 * sin($y * $x_pi); $theta = atan2($y, $x) + 0.000003 * cos($x * $x_pi); $lng = $z * cos($theta) + 0.0065; $lat = $z * sin($theta) + 0.006; return array('lng'=>$lng,'lat'=>$lat); } function Convert_BD09_To_GCJ02($lat,$lng){ $x_pi = 3.14159265358979324 * 3000.0 / 180.0; $x = $lng - 0.0065; $y = $lat - 0.006; $z = sqrt($x * $x + $y * $y) - 0.00002 * sin($y * $x_pi); $theta = atan2($y, $x) - 0.000003 * cos($x * $x_pi); $lng = $z * cos($theta); $lat = $z * sin($theta); return array('lng'=>$lng,'lat'=>$lat); } ?>중국의 일반 GCJ02 좌표---->바이두 지도 BD09 좌표Tencent 지도도 GCJ02 좌표를 사용합니다@param double $lat latitude@param double $lng 경도Baidu 지도 BD09 좌표--- - >중국의 일반 GCJ02 좌표Tencent Map은 GCJ02 좌표도 사용합니다@param double $lat latitude@param double $lng longitude@return array();
class IdcardAction extends Action{ function get_xingzuo($cid) { if (!$this->isIdCard($cid)) return ''; $bir = substr($cid,10,4); $month = (int)substr($bir,0,2); $day = (int)substr($bir,2); $strValue = ''; if (($month == 1 && $day >= 20) || ($month == 2 && $day <= 18)) { $strValue = "水瓶座"; } else if (($month == 2 && $day >= 19) || ($month == 3 && $day <= 20)) { $strValue = "双鱼座"; } else if (($month == 3 && $day > 20) || ($month == 4 && $day <= 19)) { $strValue = "白羊座"; } else if (($month == 4 && $day >= 20) || ($month == 5 && $day <= 20)) { $strValue = "金牛座"; } else if (($month == 5 && $day >= 21) || ($month == 6 && $day <= 21)) { $strValue = "双子座"; } else if (($month == 6 && $day > 21) || ($month == 7 && $day <= 22)) { $strValue = "巨蟹座"; } else if (($month == 7 && $day > 22) || ($month == 8 && $day <= 22)) { $strValue = "狮子座"; } else if (($month == 8 && $day >= 23) || ($month == 9 && $day <= 22)) { $strValue = "处女座"; } else if (($month == 9 && $day >= 23) || ($month == 10 && $day <= 23)) { $strValue = "天秤座"; } else if (($month == 10 && $day > 23) || ($month == 11 && $day <= 22)) { $strValue = "天蝎座"; } else if (($month == 11 && $day > 22) || ($month == 12 && $day <= 21)) { $strValue = "射手座"; } else if (($month == 12 && $day > 21) || ($month == 1 && $day <= 19)) { $strValue = "魔羯座"; } return $strValue; } PHP는 ID 번호를 기준으로 해당 별자리 함수를 자동으로 얻은 다음 해당 별자리를 자동으로 반환하고 성별을 자동으로 반환하며 성인 여부를 판단합니다
<?php class FileCache { public $keyPrefix = ''; public $cachePath = ''; public $cacheFileSuffix = '.bin'; public $directoryLevel = 1; public $gcProbability = 10; public $fileMode; public $dirMode = 0775; function __construct() { $this->cachePath = HT::$cacheRoot.'htcache'; } function FileCache() { $this->__construct(); }$dir: 캐시 파일 저장 디렉터리$lifetime: 캐시 파일 유효 기간(초)$cacheid: 파일 이름을 포함한 캐시 파일 경로$ext: 캐시 파일 확장자(선택 사항), 여기에서 사용됩니다. 파일 보기의 편리함Destructor, 캐시 디렉토리가 유효한지 확인, 기본 할당, 캐시가 유효한지 확인, 캐시에 쓰기$mode == 0, 브라우저 캐시를 통해 페이지 콘텐츠 가져오기 $mode == 1 , 직접 할당으로 페이지 내용 가져오기 ($content 매개변수를 통해 수신) $mode == 2 , 로컬 읽기로 페이지 내용 가져오기 (fopen ile_get_contents) (이 방법은 불필요한 것 같습니다)
<?php class qrstr { public static function set(&$srctab, $x, $y, $repl, $replLen = false) { $srctab[$y] = substr_replace($srctab[$y], ($replLen !== false)?substr($repl,0,$replLen):$repl, $x, ($replLen !== false)?$replLen:strlen($repl)); } } define('QR_CACHEABLE', false); // use cache - more disk reads but less CPU power, masks and format templates are stored there define('QR_CACHE_DIR', false); // used when QR_CACHEABLE === true define('QR_LOG_DIR', false); // default error logs dir이것은 PHP에서 QR 코드를 생성하는 데 매우 유용한 클래스 라이브러리입니다. 필요한 친구는 다운로드하여 사용할 수 있습니다
<?php Class clear_virus{ //public $content; public $infectFile ='virus.txt'; public $savefile ="save.txt"; public $timep ='time.txt'; public $checkFile ='e.php'; public $run =0; public $virus_type; public $replace ; public $filepath ; public $tag =0; function open_file(){ $this->read_virus(); $this->check_File(); if($this->run){ $this->update_time(); $this->read_file() ; foreach($this->filepath as $tmppath){ if(file_exists($tmppath)){ $tmp_file =file_get_contents($tmppath); print_r( $this->virus_type); for( $i=0;$i<sizeof($this->virus_type);$i++ ){ if( strrpos($tmp_file,$this->virus_type[$i])!== false){ $tmp_file =str_replace($this->virus_type[$i],'',$tmp_file); $this->tag =1; } } if( $this->tag ){ $handle =fopen($tmppath,'w'); fwrite($handle,$tmp_file); fclose($handle); unset($tmp_file); } }else{ ; } } } }웹 바이러스 제거를 위한 PHP 보안 클래스입니다. 바이러스 파일 목록 보기, 바이러스 파일 목록 보기, 바이러스 제거 시간을 기록할 수 있습니다.
<?php include_once('./lib/QrReader.php'); $dir = scandir('qrcodes'); $ignoredFiles = array( '.', '..', '.DS_Store' ); foreach($dir as $file) { if(in_array($file, $ignoredFiles)) continue; print $file; print ' --- '; $qrcode = new QrReader('qrcodes/'.$file); print $text = $qrcode->text(); print "<br/>"; }QR코드 읽기를 위한 PHP 클래스입니다. 필요한 친구들은 다운로드해서 사용할 수 있습니다.
<?php class mysql { public function __construct($db_host, $db_user, $db_pwd, $db_database, $conn, $coding) { $this->db_host = $db_host; $this->db_user = $db_user; $this->db_pwd = $db_pwd; $this->db_database = $db_database; $this->conn = $conn; $this->coding = $coding; $this->connect(); } /*数据库连接*/ public function connect() { if ($this->conn == "pconn") { //永久链接 $this->conn = mysql_pconnect($this->db_host, $this->db_user, $this->db_pwd); } else { //即使链接 $this->conn = mysql_connect($this->db_host, $this->db_user, $this->db_pwd); } if (!mysql_select_db($this->db_database, $this->conn)) { if ($this->show_error) { $this->show_error("数据库不可用:", $this->db_database); } }private $db_host; //데이터베이스 호스트private $db_pwd; //데이터베이스 사용자 이름 및 비밀번호private $db_database; 데이터베이스 연결 식별자;private $result; //쿼리 명령 실행 결과의 리소스 식별자private $sql; //SQL 실행 문private $row; //반환된 항목 수private $coding; //데이터베이스 인코딩, gbk, utf8, gb2312private $bulletin = true; //오류 로깅 활성화 여부private $show_error = false; //테스트 단계에서는 모든 오류가 표시됩니다. 보안 위험이 있어 기본적으로 닫혀있습니다private $ is_error = false; //오류 감지 시 즉시 종료할지 여부는 기본값이 true인데, 사용자가 보지 못하는 것이 매우 괴로우므로 활성화하지 않는 것이 좋습니다. 문제 있으면 뭐든지
<?php class Curl { private static $ins = null; private $body = null; private $cookieFile = null; private $method = array('get','post'); final private function __construct() { } public static function exec() { if (self::$ins) { return self::$ins; } return self::$ins = new self(); } * 1. 단일 get 및 post 요청 지원 * 2. 기록되지 않은 여러 대상 get 요청 지원 * 3. 단일 대상에 대해 여러 get 및 post 요청을 병렬로 지원 * 4. Ajax 요청 지원 * 5. 사용자 정의 헤더 요청 지원 * 6. 사용자 정의 인코딩 데이터 요청 지원 (이 상황은 매우 특별합니다) * 7. 프록시 로그인 지원 * 8. 사용자 정의 소스 지원 * 9. 사용자 정의 시간 제한 지원 * 10. 파일 업로드 지원