p.p1 { margin: 0.0px 0.0px 0.0px 0.0px; font: 13.0px Menlo; color: #000000; min-height: 15.0px }
p.p2 { margin: 0.0px 0.0px 0.0px 0.0px; font: 13.0px "PingFang SC"; color: #008400 }
p.p3 { margin: 0.0px 0.0px 0.0px 0.0px; font: 13.0px Menlo; color: #d12f1b }
p.p4 { margin: 0.0px 0.0px 0.0px 0.0px; font: 13.0px Menlo; color: #000000 }
p.p5 { margin: 0.0px 0.0px 0.0px 0.0px; font: 13.0px Menlo; color: #ba2da2 }
p.p6 { margin: 0.0px 0.0px 0.0px 0.0px; font: 13.0px Menlo; color: #008400 }
p.p7 { margin: 0.0px 0.0px 0.0px 0.0px; font: 13.0px Menlo; color: #31595d }
p.p8 { margin: 0.0px 0.0px 0.0px 0.0px; font: 13.0px Menlo; color: #3e1e81 }
p.p9 { margin: 0.0px 0.0px 0.0px 0.0px; font: 13.0px Menlo; color: #703daa }
p.p10 { margin: 0.0px 0.0px 0.0px 0.0px; font: 13.0px Menlo; color: #78492a }
p.p11 { margin: 0.0px 0.0px 0.0px 0.0px; font: 13.0px Menlo; color: #008400; min-height: 15.0px }
span.s1 { }
span.s2 { font: 13.0px Menlo }
span.s3 { color: #78492a }
span.s4 { color: #008400 }
span.s5 { font: 13.0px "PingFang SC"; color: #008400 }
span.s6 { color: #ba2da2 }
span.s7 { color: #4f8187 }
span.s8 { font: 13.0px Menlo; color: #000000 }
span.s9 { color: #703daa }
span.s10 { color: #000000 }
span.s11 { color: #31595d }
span.s12 { color: #3e1e81 }
span.s13 { color: #272ad8 }
span.s14 { color: #d12f1b }
span.s15 { font: 13.0px "PingFang SC"; color: #d12f1b }
span.s16 { font: 13.0px "PingFang SC" }
p.p1 { margin: 0.0px 0.0px 0.0px 0.0px; font: 13.0px "PingFang SC"; color: #008400 }
span.s1 { }

使用第三方:科大讯飞语音

// --------------------------AppDelegate实现--------------------------------------

p.p1 { margin: 0.0px 0.0px 0.0px 0.0px; font: 13.0px Menlo; color: #4f8187 }
p.p2 { margin: 0.0px 0.0px 0.0px 0.0px; font: 13.0px Menlo; color: #000000; min-height: 15.0px }
p.p3 { margin: 0.0px 0.0px 0.0px 0.0px; font: 13.0px Menlo; color: #ba2da2 }
p.p4 { margin: 0.0px 0.0px 0.0px 0.0px; font: 13.0px "PingFang SC"; color: #008400 }
p.p5 { margin: 0.0px 0.0px 0.0px 0.0px; font: 13.0px Menlo; color: #000000 }
p.p6 { margin: 0.0px 0.0px 0.0px 0.0px; font: 13.0px Menlo; color: #008400 }
p.p7 { margin: 0.0px 0.0px 0.0px 0.0px; font: 13.0px Menlo; color: #31595d }
p.p8 { margin: 0.0px 0.0px 0.0px 0.0px; font: 13.0px Menlo; color: #3e1e81 }
p.p9 { margin: 0.0px 0.0px 0.0px 0.0px; font: 13.0px Menlo; color: #703daa }
p.p10 { margin: 0.0px 0.0px 0.0px 0.0px; font: 13.0px Menlo; color: #78492a }
span.s1 { color: #ba2da2 }
span.s2 { color: #000000 }
span.s3 { }
span.s4 { font: 13.0px Menlo }
span.s5 { font: 13.0px "PingFang SC" }
span.s6 { color: #4f8187 }
span.s7 { color: #78492a }
span.s8 { color: #d12f1b }
span.s9 { color: #272ad8 }
span.s10 { font: 13.0px Menlo; color: #000000 }
span.s11 { color: #703daa }
span.s12 { color: #3e1e81 }
span.s13 { color: #31595d }

@interface AppDelegate ()

@end

@implementation AppDelegate

-(void)initIfly{

dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{

//科大讯飞语音初始化

//创建语音配置,appid必须要传入,仅执行一次则可

NSString *initString = [[NSString alloc] initWithFormat:@"appid=%@",@"55b19e88"];

//所有服务启动前,需要确保执行createUtility

[IFlySpeechUtility createUtility:initString];

});

}

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

// Override point for customization after application launch.

[self initIfly];

UINavigationBar *bar = [UINavigationBar appearance];

bar.tintColor = navigationBarColor;

return YES;

}

// --------------------------控制器实现--------------------------------------

//包含头文件

//文字转语音

#import "iflyMSC/IFlySpeechConstant.h"

#import "iflyMSC/IFlySpeechSynthesizer.h"

#import "iflyMSC/IFlySpeechSynthesizerDelegate.h"

//语音转文字

#import "iflyMSC/IFlySpeechRecognizer.h"

#import "iflyMSC/IFlySpeechRecognizerDelegate.h"

#import "ISRDataHelper.h"

#import <LocalAuthentication/LocalAuthentication.h>//指纹识别

@interface SpeechViewController ()<IFlySpeechSynthesizerDelegate,IFlySpeechRecognizerDelegate,UITextFieldDelegate>

{

IFlySpeechSynthesizer * _iFlySpeechSynthesizer;

//不带界面的识别对象

IFlySpeechRecognizer *_iFlySpeechRecognizer;

UILabel *_textLabel;

NSString *_resultStr;

NSMutableArray *_dataSourceArray;

}

@end

@implementation SpeechViewController

- (void)viewDidLoad {

[super viewDidLoad];

// Do any additional setup after loading the view.

self.view.backgroundColor = [UIColor whiteColor];

[self initData];

[self initIFly];

[self initViews];

[self initTouchIDBtn];

//    UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(HideKeyboard)];

//    [self.view addGestureRecognizer:tap];

UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];

btn.frame = CGRectMake(50, 200, 60, 40);

btn.tag = 100;

[btn setTitle:@"按钮" forState:UIControlStateNormal];

[btn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];

[btn addTarget:self action:@selector(OnTapBtn:) forControlEvents:UIControlEventTouchUpInside];

[self.view addSubview:btn];

}

-(void)viewDidAppear:(BOOL)animated{

[self initAnimationView];

}

-(void)OnTapBtn:(UIButton *)sender{

UIButton *btn = (UIButton *)[self.view viewWithTag:100];

CAKeyframeAnimation *animation=[self shakeAnimation:btn.layer.frame];

[btn.layer addAnimation:animation forKey:kCATransition];

}

static int numberOfShakes = 3;//震动次数

static float durationOfShake = 1.0f;//震动时间

static float vigourOfShake = 0.05f;//震动幅度

- (CAKeyframeAnimation *)shakeAnimation:(CGRect)frame

{

CAKeyframeAnimation *shakeAnimation = [CAKeyframeAnimation animationWithKeyPath:@"position"];

CGMutablePathRef shakePath = CGPathCreateMutable();

CGPathMoveToPoint(shakePath, NULL, CGRectGetMidX(frame), CGRectGetMidY(frame) );

for (int index = 0; index < numberOfShakes; ++index)

{

CGPathAddLineToPoint(shakePath, NULL, CGRectGetMidX(frame) - frame.size.width * vigourOfShake,CGRectGetMidY(frame));

CGPathAddLineToPoint(shakePath, NULL,  CGRectGetMidX(frame) + frame.size.width * vigourOfShake,CGRectGetMidY(frame));

}

CGPathCloseSubpath(shakePath);

shakeAnimation.path = shakePath;

shakeAnimation.duration = durationOfShake;

CFRelease(shakePath);

return shakeAnimation;

}

-(void)HideKeyboard{

[self.view endEditing:YES];

}

- (void)didReceiveMemoryWarning {

[super didReceiveMemoryWarning];

// Dispose of any resources that can be recreated.

}

-(void)initData{

_dataSourceArray = [[NSMutableArray alloc] init];

}

-(void)initViews{

//搜索框

self.textField = [[UITextField alloc] initWithFrame:CGRectMake(10, 64+10, screen_width-60, 30)];

self.textField.delegate = self;

self.textField.clearButtonMode = UITextFieldViewModeAlways;

self.textField.placeholder = @"请 “尝试语音输入“";

self.textField.text = @"";

self.textField.backgroundColor = RGB(242, 242, 242);

self.textField.font = [UIFont systemFontOfSize:14];

self.textField.borderStyle = UITextBorderStyleRoundedRect;

[self.view addSubview:self.textField];

//语音按钮

UIImageView *voiceImageView = [[UIImageView alloc] initWithFrame:CGRectMake(screen_width-60, 64+6, 60, 36)];

[voiceImageView setImage:[UIImage imageNamed:@"voice"]];

[self.view addSubview:voiceImageView];

UITapGestureRecognizer *voiceTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(OnTapVoice)];

voiceImageView.userInteractionEnabled = YES;

[voiceImageView addGestureRecognizer:voiceTap];

//

_textLabel = [[UILabel alloc] initWithFrame:CGRectMake(10, 150, screen_width-10, 100)];

_textLabel.numberOfLines = 0;

_textLabel.text = @"";

_textLabel.hidden = YES;

_textLabel.lineBreakMode = NSLineBreakByWordWrapping;

_textLabel.textColor = navigationBarColor;

[self.view addSubview:_textLabel];

}

-(void)setNav{

UIView *backView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, screen_width, 64)];

backView.backgroundColor = navigationBarColor;

[self.view addSubview:backView];

//返回按钮

UIButton *backBtn = [UIButton buttonWithType: UIButtonTypeCustom];

backBtn.frame = CGRectMake(0, 20, 40, 40);

[backBtn setImage:[UIImage imageNamed:@"file_tital_back_but"] forState:UIControlStateNormal];

//    [backBtn addTarget:self action:@selector(OnTapBackBtn:) forControlEvents:UIControlEventTouchUpInside];

[backView addSubview:backBtn];

//标题

UILabel *titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(screen_width/2-60, 20, 120, 40)];

titleLabel.textAlignment = NSTextAlignmentCenter;

titleLabel.textColor = [UIColor whiteColor];

titleLabel.text = @"课程详情";

[backView addSubview:titleLabel];

//收藏

UIButton *collectBtn = [UIButton buttonWithType: UIButtonTypeCustom];

collectBtn.frame = CGRectMake(screen_width-60, 20, 40, 40);

//    [collectBtn setImage:[UIImage imageNamed:@"course_info_bg_collect"] forState:UIControlStateNormal];

//    [collectBtn setImage:[UIImage imageNamed:@"course_info_bg_collected"] forState:UIControlStateSelected];

[collectBtn setTitle:@"搜索" forState:UIControlStateNormal];

[collectBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];

[collectBtn addTarget:self action:@selector(OnTapCollectBtn:) forControlEvents:UIControlEventTouchUpInside];

[backView addSubview:collectBtn];

}

-(void)initAnimationView{

UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 100, 100)];

view.backgroundColor = [UIColor redColor];

[self.view addSubview:view];

CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"position"];

animation.fromValue = [NSValue valueWithCGPoint:CGPointMake(150, 100)];

animation.toValue = [NSValue valueWithCGPoint:CGPointMake(250, 100)];

//    animation.timingFunction

//    animation.beginTime

animation.duration = 1.0;

[view.layer addAnimation:animation forKey:nil];

//    CAMediaTimingFunction

view.frame = CGRectOffset(view.frame, 100, 0);

}

//响应函数

-(void)OnTapBackBtn:(UIButton *)sender{

[self.navigationController popViewControllerAnimated:YES];

}

-(void)OnTapCollectBtn:(UIButton *)sender{

[self.view endEditing:YES];

if ([self.textField.text isEqualToString:@""]) {

UIAlertView *alertV = [[UIAlertView alloc] initWithTitle:@"提示" message:@"请输入内容再搜索" delegate:self cancelButtonTitle:@"好" otherButtonTitles:nil, nil];

[alertV show];

return;

}

}

-(void)OnBeginBtn:(UIButton *)sender{

//    [iFlySpeechRecognizer startListening];

_textLabel.text = @"";

[self speechRecognize];

}

-(void)OnEndBtn:(UIButton *)sender{

[_iFlySpeechRecognizer stopListening];

}

-(void)OnTapVoice{

_textLabel.text = @"";

[self startBtn];

}

//有界面

-(void)initRecognizer{

//单例模式,UI的实例

if (_iflyRecognizerView == nil) {

//UI显示剧中

_iflyRecognizerView= [[IFlyRecognizerView alloc] initWithCenter:self.view.center];

[_iflyRecognizerView setParameter:@"" forKey:[IFlySpeechConstant PARAMS]];

//设置听写模式

[_iflyRecognizerView setParameter:@"iat" forKey:[IFlySpeechConstant IFLY_DOMAIN]];

}

_iflyRecognizerView.delegate = self;

if (_iflyRecognizerView != nil) {

//设置最长录音时间

[_iflyRecognizerView setParameter:@"30000" forKey:[IFlySpeechConstant SPEECH_TIMEOUT]];

//设置后端点 3000

[_iflyRecognizerView setParameter:@"3000" forKey:[IFlySpeechConstant VAD_EOS]];

//设置前端点   3000

[_iflyRecognizerView setParameter:@"3000" forKey:[IFlySpeechConstant VAD_BOS]];

//设置采样率,推荐使用16K    16000

[_iflyRecognizerView setParameter:@"16000" forKey:[IFlySpeechConstant SAMPLE_RATE]];

//        if ([instance.language isEqualToString:[IATConfig chinese]]) {

//            //设置语言   zh_cn

[_iflyRecognizerView setParameter:@"zh_cn" forKey:[IFlySpeechConstant LANGUAGE]];

//            //设置方言  mandarin

[_iflyRecognizerView setParameter:@"mandarin" forKey:[IFlySpeechConstant ACCENT]];

//        }else if ([instance.language isEqualToString:[IATConfig english]]) {

//            //设置语言

//            [_iflyRecognizerView setParameter:instance.language forKey:[IFlySpeechConstant LANGUAGE]];

//        }

//        //设置是否返回标点符号   0

[_iflyRecognizerView setParameter:@"0" forKey:[IFlySpeechConstant ASR_PTT]];

}

}

/**

*  启动听写

*/

-(void)startBtn{

if (_iflyRecognizerView == nil) {

[self initRecognizer ];

}

//设置音频来源为麦克风

[_iflyRecognizerView setParameter:IFLY_AUDIO_SOURCE_MIC forKey:@"audio_source"];

//设置听写结果格式为json

[_iflyRecognizerView setParameter:@"plain" forKey:[IFlySpeechConstant RESULT_TYPE]];

//保存录音文件,保存在sdk工作路径中,如未设置工作路径,则默认保存在library/cache下

[_iflyRecognizerView setParameter:@"asr.pcm" forKey:[IFlySpeechConstant ASR_AUDIO_PATH]];

[_iflyRecognizerView start];

}

//文字转语音

-(void)initIFly{

//1.创建合成对象

_iFlySpeechSynthesizer = [IFlySpeechSynthesizer sharedInstance];

_iFlySpeechSynthesizer.delegate = self;

//2.设置合成参数

//设置在线工作方式

[_iFlySpeechSynthesizer setParameter:[IFlySpeechConstant TYPE_CLOUD]

forKey:[IFlySpeechConstant ENGINE_TYPE]];

//音量,取值范围 0~100

[_iFlySpeechSynthesizer setParameter:@"50" forKey: [IFlySpeechConstant VOLUME]]; //发音人,默认为”xiaoyan”,可以设置的参数列表可参考“合成发音人列表”

[_iFlySpeechSynthesizer setParameter:@"xiaoxin" forKey: [IFlySpeechConstant VOICE_NAME]]; //保存合成文件名,如不再需要,设置设置为nil或者为空表示取消,默认目录位于 library/cache下

[_iFlySpeechSynthesizer setParameter:@"tts.pcm" forKey: [IFlySpeechConstant TTS_AUDIO_PATH]];

//3.启动合成会话

//    [_iFlySpeechSynthesizer startSpeaking: @"喜欢你,那双眼动人,笑声更迷人,愿再可,轻抚你。你好,我是科大讯飞的小燕"];

[_iFlySpeechSynthesizer startSpeaking: @"我只是个小孩,干吗那么认真啊。不对,动感超人是这样笑的,5呼呼呼呼~~~~~~。"];

}

//听写

-(void)speechRecognize{

//1.创建语音听写对象

_iFlySpeechRecognizer = [IFlySpeechRecognizer sharedInstance]; //设置听写模式

_iFlySpeechRecognizer.delegate = self;

[_iFlySpeechRecognizer setParameter:@"iat" forKey:[IFlySpeechConstant IFLY_DOMAIN]];

//2.设置听写参数

[_iFlySpeechRecognizer setParameter: @"iat" forKey: [IFlySpeechConstant IFLY_DOMAIN]];

//asr_audio_path是录音文件名,设置value为nil或者为空取消保存,默认保存目录在 Library/cache下。

[_iFlySpeechRecognizer setParameter:@"asrview.pcm" forKey:[IFlySpeechConstant ASR_AUDIO_PATH]];

//3.启动识别服务

[_iFlySpeechRecognizer startListening];//官网文档里有错误,不是start

}

#pragma mark - IFlySpeechSynthesizerDelegate

//结束代理

-(void)onCompleted:(IFlySpeechError *)error{

NSLog(@"onCompleted");

}

//合成开始

- (void) onSpeakBegin{

NSLog(@"onSpeakBegin");

}

//合成缓冲进度

- (void) onBufferProgress:(int) progress message:(NSString *)msg{

NSLog(@"onBufferProgress");

}

//合成播放进度

- (void) onSpeakProgress:(int) progress{

//    NSLog(@"onSpeakProgress");

}

#pragma mark - IFlySpeechRecognizerDelegate

//没有界面时的语音听写

//识别结果返回代理

-(void)onResults:(NSArray *)results isLast:(BOOL)isLast{

NSMutableString *result = [[NSMutableString alloc] init];

NSDictionary *dic = [results objectAtIndex:0];

for (NSString *key in dic)

{

[result appendFormat:@"%@",key];//合并结果

}

NSLog(@"识别成功:%@",result);

_resultStr = [NSString stringWithFormat:@"%@%@",_textLabel.text,result];

NSString * resultFromJson =  [ISRDataHelper stringFromJson:result];

_textLabel.text = [NSString stringWithFormat:@"%@%@", _textLabel.text,resultFromJson];

}

-(void)onError:(IFlySpeechError *)errorCode{

NSLog(@"识别失败");

}

-(void)onEndOfSpeech{

NSLog(@"停止录音");

}

-(void)onBeginOfSpeech{

NSLog(@"开始录音");

}

-(void)onVolumeChanged:(int)volume{

//    NSLog(@"音量");

}

/**

有界面,听写结果回调

resultArray:听写结果

isLast:表示最后一次

****/

- (void)onResult:(NSArray *)resultArray isLast:(BOOL)isLast

{

NSMutableString *result = [[NSMutableString alloc] init];

NSDictionary *dic = [resultArray objectAtIndex:0];

for (NSString *key in dic) {

[result appendFormat:@"%@",key];

}

_textLabel.text = [NSString stringWithFormat:@"%@%@",_textLabel.text,result];

if (isLast) {

NSLog(@"结果:%@",_textLabel.text);

self.textField.text = _textLabel.text;

}

}

-(void)viewWillDisappear:(BOOL)animated{

[_iFlySpeechSynthesizer stopSpeaking];

[_iFlySpeechRecognizer stopListening];

}

#pragma mark - UITextFieldDelegate

-(BOOL)textFieldShouldReturn:(UITextField *)textField{

[textField resignFirstResponder];

return YES;

}

//=============指纹识别==================

-(void)initTouchIDBtn{

UIButton *touchIDBtn = [UIButton buttonWithType:UIButtonTypeCustom];

touchIDBtn.frame = CGRectMake(50, 300, 60, 40);

[touchIDBtn setTitle:@"指纹" forState:UIControlStateNormal];

[touchIDBtn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];

[touchIDBtn addTarget:self action:@selector(OnTouchIDBtn:) forControlEvents:UIControlEventTouchUpInside];

[self.view addSubview:touchIDBtn];

}

-(void)OnTouchIDBtn:(UIButton *)sender{

if ([[UIDevice currentDevice].systemVersion floatValue] < 8.0) {

NSLog(@"不支持指纹识别");

return;

}else{

LAContext *ctx = [[LAContext alloc] init];

if ([ctx canEvaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics error:nil]) {

NSLog(@"支持");

[ctx evaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics localizedReason:@"指纹识别" reply:^(BOOL success, NSError * error) {

if (success) {

NSLog(@"识别成功");

}else{

NSLog(@"识别失败");

}

}];

}

}

}

@end

ios语音识别的更多相关文章

  1. iOS语音识别,语音播报,文字变语音播报,语音变文字

    首先使用的是科大讯飞的sdk 1.语音识别部分 AppDelegate.m #import "AppDelegate.h" #import <iflyMSC/iflyMSC. ...

  2. [ios]ios语音识别

    参考:http://blog.sina.com.cn/s/blog_923fdd9b0101flx1.html 通过谷歌语音接口的实现语音识别 最近在项目中有需要实现语音识别的功能.折腾了几天才搞好. ...

  3. iOS 语音识别使用讯飞报错

    You must rebuild it with bitcode enabled(Xcode setting ENABLE_BITCODE), obtain an updated library fr ...

  4. ios实例开发精品文章推荐(7.22)

    UIView 基本方法 UIView的一些基本方法理解:loadView.viewDidLoad.viewDidUnload.viewWillAppear,viewWillDisappear init ...

  5. iOS 端的第三方语音识别库

    最近在看语音识别方面的库,主要看了2个收费的项目,一个是 At&t 的,一个是Nuance的.这2个项目虽然是收费的,但是仅仅测试的话,是免费的,连接如下 https://developer. ...

  6. iOS 10 语音识别Speech Framework详解

    最近做了一个项目,涉及到语音识别,使用的是iOS的speech Framework框架,在网上搜了很多资料,也看了很多博客,但介绍的不是很详细,正好项目做完,在这里给大家详解一下speech Fram ...

  7. 语音识别完成诗句的查询功能,iOS AVSpeechSynthesis语音输出结果的诗歌APP

    前言 当前的APP的查询都是使用手动输入,不仅效率低,而且查询的语句的限制比较大,不能够方便的扩展. 如果能方便的扩展查询语句,那么APP的使用就会有很大的灵活性.可以设计各种问句和语句,可以方便的和 ...

  8. iOS:百度长语音识别具体的封装:识别、播放、进度刷新

    一.介绍 以前做过讯飞语音识别,比较简单,识别率很不错,但是它的识别时间是有限制的,最多60秒.可是有的时候我们需要更长的识别时间,例如朗诵古诗等功能.当然讯飞语音也是可以通过曲线救国来实现,就是每达 ...

  9. iOS中 语音识别功能/语音转文字教程具体解释 韩俊强的博客

    原文地址:http://blog.csdn.net/qq_31810357/article/details/51111702 前言:近期研究了一下语音识别,从百度语音识别到讯飞语音识别:首先说一下个人 ...

随机推荐

  1. 安装了ruby后怎么安装sass

    在命令行中输入 ruby -v 查看版本号 先移除默认的https://rubygems.org源,命令为gem sources --remove https://rubygems.org/,按回车 ...

  2. asp.net配置web.config支持jQuery.Uploadify插件上传大文件

    配置web.config有两处地方需要配置,分别是集成模式和经典模式. 集成模式: <!--文件上传大小设置--> <httpRuntime requestValidationMod ...

  3. Linux问题处理: stdio.h: No such file or directory linux

    本来打算编译一下<自制编程语言>一书的代码,结果提示错误: 其实说的还是很清楚的,一般出现这种情况都是没有安装相应的库,所以: 再次编译,成功: 测试代码: # comment print ...

  4. Python操作MySQL

    本篇对于Python操作MySQL主要使用两种方式: 原生模块 pymsql ORM框架 SQLAchemy pymsql pymsql是Python中操作MySQL的模块,其使用方法和MySQLdb ...

  5. postman 测试API - token

    1.使用全局变量保存token 2.再调用 参考文章 http://www.jianshu.com/p/13c8017bb5c8 https://testerhome.com/topics/6555

  6. thinkphp访问不存在的模块或者方法跳转到404页面

    使用的thinkphp 版本是3.2.0, 在config.php中配置 404地址,即可: 'TMPL_EXCEPTION_FILE' => './Application/Home/View/ ...

  7. UP Board 人若有大胆,板子就很惨:首次上电开机失败

    前言 原创文章,转载引用务必注明链接. 注意:拍照自带抖动功能,画质大家凑合着看.冬日天气干燥,手触摸板子前建议流水洗手或者握持大体积导电体将静电放走. 本文使用Markdown写成,为获得更好的阅读 ...

  8. Nginx配置(全)

    安装 * windows下:直接到官网下载windows下的稳定版本,解压到任意位置即可 * Linux下:一种方式是yum或者sudo apt-get install 另一种是源码编译安装,先安装p ...

  9. python 单例模式

    单例模式,也叫单子模式,是一种常用的软件设计模式.在应用这个模式时,单例对象的类必须保证只有一个实例存在 用装饰器方式实现单例模式 #!/usr/bin/python # coding=utf-8 d ...

  10. js 刷新页面window.location.reload();

    Javascript刷新页面的几种方法:1    history.go(0)2    window.location.reload() window.location.reload(true) 3   ...