当前位置: 编程技术>php
本页文章导读:
▪PHP中函数内引用全局变量的方法
先看下面的代码: 代码如下:<?php $var1 = "#####"; $var2 = "&&&&&"; function global_references($use_globals) { global $var1, $var2; if (!$use_globals) { $var2 =&$var1; //1 } else { $GLOBALS["var2"] =&$var1; .........
▪sqlyog 中文乱码问题的设置方法
1.在SQLyog下输入下面代码,全部执行 SET character_set_client = utf8; SET character_set_results = gb2312; SET character_set_connection = utf8; 如果上边的不行,还可以改成Gbk。总以根据你的数据的文字编码改成相.........
▪mysql5的sql文件导入到mysql4的方法
1、将mysql5里导出的sql文件导入到mysql5中。 2、用mysqldump -uroot -p1234 --opt --compatible=mysql40 -A -re:\localhost.sql --compatible=name参数描述如下: --compatible=name Change the dump to be compatible with a given mode. By d.........
[1]PHP中函数内引用全局变量的方法
来源: 互联网 发布时间: 2013-11-30
先看下面的代码:
<?php
$var1 = "#####";
$var2 = "&&&&&";
function global_references($use_globals)
{
global $var1, $var2;
if (!$use_globals) {
$var2 =&$var1; //1
} else {
$GLOBALS["var2"] =&$var1; //2
}
}
global_references(false);
echo "var2 is set to '$var2'<br/>";
global_references(true);
echo "var2 is set to '$var2'<br/>";
?>
输出的结果如下:
var2 is set to '&&&&&'
var2 is set to '#####'
可见,上面的代码中:
$var2 =&$var1; //1
只对函数内部可见。
而
$GLOBALS["var2"] =&$var1; //2
在全局范围内可见。
代码如下:
<?php
$var1 = "#####";
$var2 = "&&&&&";
function global_references($use_globals)
{
global $var1, $var2;
if (!$use_globals) {
$var2 =&$var1; //1
} else {
$GLOBALS["var2"] =&$var1; //2
}
}
global_references(false);
echo "var2 is set to '$var2'<br/>";
global_references(true);
echo "var2 is set to '$var2'<br/>";
?>
var2 is set to '&&&&&'
var2 is set to '#####'
可见,上面的代码中:
$var2 =&$var1; //1
只对函数内部可见。
而
$GLOBALS["var2"] =&$var1; //2
在全局范围内可见。
[2]sqlyog 中文乱码问题的设置方法
来源: 互联网 发布时间: 2013-11-30
1.在SQLyog下输入下面代码,全部执行
SET character_set_client = utf8;
SET character_set_results = gb2312;
SET character_set_connection = utf8;
如果上边的不行,还可以改成Gbk。总以根据你的数据的文字编码改成相应的编码类型就ok了。给出Gbk的代码:
SET character_set_client = gbK;
SET character_set_results = gbK;
SET character_set_connection = utf8;
但是重启SQL之后又不行了。
2.Tools->Preference Base->Editor 修改Fonts
修改完成后,重新启动SQLyog就好了!
SET character_set_client = utf8;
SET character_set_results = gb2312;
SET character_set_connection = utf8;
如果上边的不行,还可以改成Gbk。总以根据你的数据的文字编码改成相应的编码类型就ok了。给出Gbk的代码:
SET character_set_client = gbK;
SET character_set_results = gbK;
SET character_set_connection = utf8;
但是重启SQL之后又不行了。
2.Tools->Preference Base->Editor 修改Fonts
修改完成后,重新启动SQLyog就好了!
[3]mysql5的sql文件导入到mysql4的方法
来源: 互联网 发布时间: 2013-11-30
1、将mysql5里导出的sql文件导入到mysql5中。
2、用mysqldump -uroot -p1234 --opt --compatible=mysql40 -A -re:\localhost.sql
--compatible=name参数描述如下:
--compatible=name Change the dump to be compatible with a given mode. By
default tables are dumped in a format optimized for
MySQL. Legal modes are: ansi, mysql323, mysql40,
postgresql, oracle, mssql, db2, maxdb, no_key_options,
no_table_options, no_field_options. One can use several
modes separated by commas. Note: Requires MySQL server
version 4.1.0 or higher. This option is ignored with
earlier server versions.
3、将e:\localhost.sql导入mysql4,如mysql命令行中
source e:\localhost.sql
2、用mysqldump -uroot -p1234 --opt --compatible=mysql40 -A -re:\localhost.sql
--compatible=name参数描述如下:
--compatible=name Change the dump to be compatible with a given mode. By
default tables are dumped in a format optimized for
MySQL. Legal modes are: ansi, mysql323, mysql40,
postgresql, oracle, mssql, db2, maxdb, no_key_options,
no_table_options, no_field_options. One can use several
modes separated by commas. Note: Requires MySQL server
version 4.1.0 or higher. This option is ignored with
earlier server versions.
3、将e:\localhost.sql导入mysql4,如mysql命令行中
source e:\localhost.sql
最新技术文章: