<?php //插入字符串 //1.双引号可以解析字符串中的变量:但是前后不能跟中文符号 $username = "gaoxiong"; echo "my name is $username";//my name is gaoxiong echo "<br>"; echo "my name is $username,";//my name is echo "<br>"; //2
定义字符串的时候,用单引号或者双引号都是可以的.我个人习惯是用双引号.在输出字符串的时候,若字符串中含有字符串变量,使用单引号和双引号则是有区别的.如下面程序: <?php $website = "NowaMagic"; $name = 'Gonn'; echo 'Welcome to visit $website. My name is $name.'; echo '<br>'; echo "Welcome to visit $website. My na
1. 简单粗鲁的字符串拼接 1 name = "abc" 2 age = 25 3 info = "the name is "+name +"\nthe age is " + str(age) 4 print(info) 运行结果: 2.% name = "abc" age = 25 info = "the name is %s \nthe age is %s"%(name ,age) print(info
bat 判断变量字符串中是否包含字符串 @echo off rem way 1 set str=machine-order-service set matchStr=orderd echo %str% | findstr %matchStr% >nul && echo yes || echo no rem end way 1 pause rem way 2 setLocal EnableDelayedExpansion if not "x!str:%matchStr%=!&