echo

PHP连接MYSQL

那年仲夏 提交于 2019-12-30 03:03:55
繁写: <?php echo " This is a test</br> " ; echo " asdfasdfadsf " ; $mysql_server_name= " localhost " ; // 数据库服务器名称 $mysql_username= " root " ; // 连接数据库用户名 $mysql_password= " ?????? " ; // 连接数据库密码 $mysql_database= " ?????? " ; // 数据库的名字 // 连接到数据库 $conn=mysql_connect($mysql_server_name, $mysql_username, $mysql_password); // 从表中提取信息的sql语句 $strsql= " SELECT * FROM `db_table` " ; // 执行sql查询 $result=mysql_db_query($mysql_database, $strsql, $conn); // 获取查询结果 $row=mysql_fetch_row($result); echo ' <font face="verdana"> ' ; echo ' <table border="1" cellpadding="1" cellspacing="2"> ' ; // 显示字段名称 echo " </b

cmd 菜单学习

非 Y 不嫁゛ 提交于 2019-12-29 22:45:20
@ECHO OFF&PUSHD %~DP0 &TITLE 标题是随意的 mode con cols=36 lines=20 color 2C :menu cls echo. echo 有什么想对 我 说的么? echo ============================== echo. echo 输入1,说我爱你 echo. echo 输入2,说我想你 echo. echo 输入3,说加我QQ echo. echo ============================== echo. echo. set /p user_input=请输入数字: if %user_input% equ 1 echo 我爱你 if %user_input% equ 2 echo 我想你 if %user_input% equ 3 echo 加我QQ pause goto menu 讲解: PUSHD %~DP0 设批处理所在路径为当前路径 效果: 来源: https://www.cnblogs.com/birdofparadise/p/6582348.html

php图片上传代码

我的梦境 提交于 2019-12-29 21:01:55
<?php /****************************************************************************** 参数说明: $max_file_size : 上传文件大小限制, 单位BYTE $destination_folder : 上传文件路径 $watermark : 是否附加水印(1为加水印,其他为不加水印); 使用说明: 1. 将PHP.INI文件里面的"extension=php_gd2.dll"一行前面的;号去掉,因为我们要用到GD库; 2. 将extension_dir =改为你的php_gd2.dll所在目录; ******************************************************************************/ //上传文件类型列表 $uptypes=array( 'image/jpg', 'image/jpeg', 'image/png', 'image/pjpeg', 'image/gif', 'image/bmp', 'image/x-png' ); $max_file_size=2000000; //上传文件大小限制, 单位BYTE $destination_folder="uploadimg/"; //上传文件路径 $watermark

shell(7):四则运算

♀尐吖头ヾ 提交于 2019-12-29 12:09:42
shell 四则运算:expr,let,bc,(()), 1、expr的用法: expr命令是一个手工命令行计数器,用于在UNIX/LINUX下求表达式变量的值,一般用于整数值,也可用于字符串。 详细使用方式:expr --help expr 表达式 表达式说明: 用空格隔开每个项; 用 / (反斜杠) 放在 shell 特定的字符前面; 对包含空格和其他特殊字符的字符串要用引号括起来 使用实例: 1、计算字串长度 > expr length "this is a test" 14 2、抓取字串 > expr substr "this is a test" 3 5 is is 3、抓取第一个字符数字串出现的位置 > expr index "sarasara" a 2 4、整数运算 > expr 14 % 9 5 > expr 10 + 10 20 > expr 1000 + 900 1900 > expr 30 / 3 / 2 5 > expr 30 \* 3 (使用乘号时,必须用反斜线屏蔽其特定含义。因为shell可能会误解显示星号的意义) 90 > expr 30 * 3 expr: Syntax error 2、let的用法: let 命令是 BASH 中用于计算的工具,用于执行一个或多个表达式,变量计算中不需要加上 $ 来表示变量。 如果表达式中包含了空格或其他特殊字符

String variable to execute PHP code

倖福魔咒の 提交于 2019-12-29 08:24:52
问题 What I want to do is pull html and PHP code out from a database and then execute it. So for example I may have: <?php $test = <<<END <p> <?php echo time(); ?> </p> END; echo $test; ?> What I want is to get $test to print <p> 12:00PM </p> //right instead of printing: <p> <?php echo time(); ?> </p> //wrong as occurs when I use the echo function. Please do not tell me how to do the same thing with JavaScript or other work around. Instead stick to the question and remember the example is just an

String variable to execute PHP code

老子叫甜甜 提交于 2019-12-29 08:24:29
问题 What I want to do is pull html and PHP code out from a database and then execute it. So for example I may have: <?php $test = <<<END <p> <?php echo time(); ?> </p> END; echo $test; ?> What I want is to get $test to print <p> 12:00PM </p> //right instead of printing: <p> <?php echo time(); ?> </p> //wrong as occurs when I use the echo function. Please do not tell me how to do the same thing with JavaScript or other work around. Instead stick to the question and remember the example is just an

Prevent “echo” from interpreting backslash escapes

前提是你 提交于 2019-12-29 07:15:51
问题 I'd like to echo something to a file that contains new line escape sequences, however I would like them to remain escaped. I'm looking for basically the opposite to this question. echo "part1\npart2" >> file I would like to look like this in the file $ cat file old part1\npart2 but it looks like $ cat file old part1 part2 回答1: This is a good example of why POSIX recommends using printf instead of echo (see here, under "application usage"): you don't know what you get with echo . You could get

Prevent “echo” from interpreting backslash escapes

爷,独闯天下 提交于 2019-12-29 07:15:09
问题 I'd like to echo something to a file that contains new line escape sequences, however I would like them to remain escaped. I'm looking for basically the opposite to this question. echo "part1\npart2" >> file I would like to look like this in the file $ cat file old part1\npart2 but it looks like $ cat file old part1 part2 回答1: This is a good example of why POSIX recommends using printf instead of echo (see here, under "application usage"): you don't know what you get with echo . You could get

How to echo JSON in PHP [closed]

最后都变了- 提交于 2019-12-28 16:35:09
问题 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 7 years ago . I just need a little help with using cURL and JSON in PHP since I never actually got around to doing this. What I am trying to accomplish is to take the ign of the payment and echoing it, also limiting on how

PHP魔术方法使用总结

梦想与她 提交于 2019-12-28 08:32:08
魔术方法 是PHP面向对象中特有的特性。它们在特定的情况下被触发,都是以双下划线开头,你可以把它们理解为钩子,利用模式方法可以轻松实现 PHP面向对象中重载 (Overloading即动态创建类属性和方法)。 魔术方法很多还是成对出现的 ,以下列出目前PHP中所有的模式方法。 1.__construct,__destruct __constuct构建对象的时被调用; __destruct明确销毁对象或脚本结束时被调用; 2.__get,__set __set当给不可访问或不存在属性赋值时被调用 __get读取不可访问或不存在属性时被调用 3.__isset,__unset __isset对不可访问或不存在的属性调用isset()或empty()时被调用 __unset对不可访问或不存在的属性进行unset时被调用 4.__call,__callStatic __call调用不可访问或不存在的方法时被调用 __callStatic调用不可访问或不存在的静态方法时被调用 5.__sleep,__wakeup __sleep当使用serialize时被调用,当你不需要保存大对象的所有数据时很有用 __wakeup当使用unserialize时被调用,可用于做些对象的初始化操作 6.__clone 进行对象clone时被调用,用来调整对象的克隆行为 7.__toString