This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="zh-CN" class="fullscreen"> | |
<head> | |
<title>flex未知高度垂直居中写法</title> | |
<style> | |
html, | |
body { | |
width: 100%; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// add child view | |
UIViewController* controller = [self.storyboard instantiateViewControllerWithIdentifier:@"test"]; | |
[self addChildViewController:controller]; | |
controller.view.frame = CGRectMake(0, 44, 320, 320); | |
[self.view addSubview:controller.view]; | |
[controller didMoveToParentViewController:self]; | |
// remove child view | |
UIViewController *vc = [self.childViewControllers lastObject]; | |
[vc.view removeFromSuperview]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if ( !file_exists('blocked_ips.txt') ) { | |
$deny_ips = array( | |
'127.0.0.1', | |
'192.168.1.1', | |
'83.76.27.9', | |
'192.168.1.163' | |
); | |
} else { | |
$deny_ips = file('blocked_ips.txt'); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// local file that should be send to the client | |
$local_file = 'test-file.zip'; | |
// filename that the user gets as default | |
$download_file = 'your-download-name.zip'; | |
// set the download rate limit (=> 20,5 kb/s) | |
$download_rate = 20.5; | |
if(file_exists($local_file) && is_file($local_file)) { | |
// send headers |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function remote_filesize($url, $user = "", $pw = "") | |
{ | |
ob_start(); | |
$ch = curl_init($url); | |
curl_setopt($ch, CURLOPT_HEADER, 1); | |
curl_setopt($ch, CURLOPT_NOBODY, 1); | |
if(!empty($user) && !empty($pw)) | |
{ | |
$headers = array('Authorization: Basic ' . base64_encode("$user:$pw")); | |
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
error_reporting(0); //抑制所有错误信息 | |
@header("content-Type: text/html; charset=utf-8"); //语言强制 | |
ob_start(); | |
$title = "Yahei-PHP Prober"; | |
$version = "v0.3.5"; //版本号 | |
define('HTTP_HOST', preg_replace('~^www\.~i', '', $_SERVER['HTTP_HOST'])); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
第一种: | |
header('Content-type: application/json'); | |
第二种: | |
header('Content-type: text/json'); | |
//第一种是标准兼容以后,第二种兼容IE6 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//点击Return按扭时收起键盘 | |
- (BOOL)textFieldShouldReturn:(UITextField *)textField | |
{ | |
return [textField resignFirstResponder]; | |
} | |
//点击背景View收起键盘(你的View必须是继承于UIControl) | |
[self.view endEditing:YES]; | |
//你可以在任何地方加上这句话,可以用来统一收起键盘 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 过滤参数 | |
* @param string $str 接受的参数 | |
* @return string | |
*/ | |
static public function filterWords($str) | |
{ | |
$farr = array( | |
"/<(\\/?)(script|i?frame|style|html|body|title|link|meta|object|\\?|\\%)([^>]*?)>/isU", | |
"/(<[^>]*)on[a-zA-Z]+\s*=([^>]*>)/isU", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//设置navigationBar文字颜色 | |
[self.navigationController.navigationBar setTitleTextAttributes: | |
@{NSForegroundColorAttributeName:[UIColor yellowColor]}]; | |
//navigationItem -> rightBarButtonItem文字颜色 | |
[self.navigationItem.rightBarButtonItem setTitleTextAttributes:@{NSForegroundColorAttributeName:[UIColor yellowColor]} | |
forState:UIControlStateNormal] |
OlderNewer