学点 C 语言(11): goto 语句

学点 C 语言(11): goto 语句

学点 C 语言(11): goto 语句例1:include <stdio.h>include <string.h>int main(void){char str[256]; scanf("%s", str); if (strlen(str) < 10) { goto Label1; } else { goto Label2; } Label1: printf("\n输入内容没有超过 10 个字符"); goto Label3; Label2: printf("...

C/C++ 2020-03-05 AM 1601℃ 0条
学点 C 语言(10): switch 语句

学点 C 语言(10): switch 语句

学点 C 语言(10): switch 语句常规:include <stdio.h>int main(void){int i; for (i = 0; i < 10; i++) { switch (i) { case 1: printf("%d\n", i); break; case 3: printf("%d\n", i); break; case 5: ...

C/C++ 2020-03-05 AM 2687℃ 0条
学点 C 语言(9): if 语句

学点 C 语言(9): if 语句

学点 C 语言(9): if 语句常规:include <stdio.h>int main(void){int i; for (i = 0; i < 10; i++) { if (i%2 == 0) printf("%d 是偶数\n", i); if (i%2 != 0) printf("%d 是奇数\n", i); } getchar(); return 0;}include <stdio.h>int main(void){int i; for (i = 0; i < 10; i++) { ...

C/C++ 2020-03-05 AM 1661℃ 0条
学点 C 语言(8): while 与 do while 循环

学点 C 语言(8): while 与 do while 循环

学点 C 语言(8): while 与 do while 循环while 循环:include <stdio.h>int main(void){int i=0; while (i<10) { i++; printf("%d\n", i); } getchar(); return 0;}do while 循环:include <stdio.h>int main(void){int i=0; do { i++; printf("%d\n", i); } wh...

C/C++ 2020-03-05 AM 2613℃ 0条
学点 C 语言(7): for 循环

学点 C 语言(7): for 循环

学点 C 语言(7): for 循环for 循环的基本形式:include <stdio.h>int main(void){int i; for (i = 0; i < 10; i++) { printf("%d\n", i); } getchar(); return 0;}步长:include <stdio.h>int main(void){int i; for (i = 0; i < 10; i += 2) { printf("%d\n", i); } getchar(); return 0;...

C/C++ 2020-03-05 AM 2522℃ 0条
学点 C 语言(3): 转义字符

学点 C 语言(3): 转义字符

学点 C 语言(3): 转义字符\n //换行 \r //回车 \b //退格 \f //换页 \t //水平制表符 \v //垂直制表符 \a //响声 \" //双引号 \' //单引号 \x?? //用小写 x 和两位数字(十六进制数)表示一个字符 \??? //用三位数字(八进制)表示一个字符 例1:#include <stdio.h> int main(void) { printf("\"C++Builder\" 2009\n"); pr...

C/C++ 2020-03-05 AM 1585℃ 0条
php 7连接mysql数据库

php 7连接mysql数据库

PHP 5 的使用者可以使用 mysql extension,mysqli 和 PDO_MYSQL 。PHP 7移除了mysql extension,只剩下后面两种选择.这份文档解释了每个API 的术语,帮助我们如何使用API 和了解相关API的信息。PHP 提供了三种不同的API去连接mysql数据库。下面的示例代码展示了3种不同连接mysql数据库的方式。/* * mysqli * 数据库地址,登陆账号,密码,数据库名称 */ $mysqli = new mysqli("localhost", "root", "", ...

PHP 2020-03-04 PM 1874℃ 0条
php字符串处理函

php字符串处理函

字符串截取:substr (str string, int start [, int length] ):从字符串中获取其中的一部分mb_substr(): 被截取的字符串中包含中英文时使用.mb_strcut(): 被截取的字符串中包含中英文时使用,共4个参数,第四个是编码(utf-8)但中间两个参数是以字节计算的,以utf-8为例:字母一字节,汉字3字节,不满字节也不会出现乱码,只是不显示出来.strstr ( string str, string needle ):查找字符串在另一个字符串中第一次出现的位置,并返回从该位置到字符串结尾的所有字符subchr():同 strstr...

PHP 2020-03-04 PM 1751℃ 0条
PHP站点打包代码

PHP站点打包代码

<?php set_time_limit(0); { $zip = new ZipArchive(); $filename = "./".date("Y-m-d")."_".md5(time())."_lzso.zip"; if ($zip->open($filename, ZIPARCHIVE::CREATE)!==TRUE) { exit("无法创建 <$filename>\n"); } $files =...

PHP 2020-03-04 AM 2472℃ 0条
PHP 随机IP

PHP 随机IP

<?phpfunction ip(){$ip_long = array( array('607649792', '608174079'), // 36.56.0.0-36.63.255.255 array('1038614528', '1039007743'), // 61.232.0.0-61.237.255.255 array('1783627776', '1784676351'), // 106.80.0.0-106.95.255.255 array('2035023872', '2035154943'), // 121.76.0.0-121.77.255.255 array...

PHP 2020-03-03 PM 1740℃ 0条
php防止XSS注入

php防止XSS注入

include('XSSProtection.php');$name = RemoveXSS($name); //防止XSS注入XSSProtection.php<?php function RemoveXSS($val) { // remove all non-printable characters. CR(0a) and LF(0b) and TAB(9) are allowed // this prevents some character re-spacing such as <java\0script> // note that you h...

PHP 2020-03-03 PM 2652℃ 0条