随笔分类 - PHP
摘要:[PHP];;;;;;;;;;;;;;;;;;;; About php.ini ;;;;;;;;;;;;;;;;;;;;; PHP's initialization file, generally called php.ini, is responsible for; configuring many of the aspects of PHP's behavior.; PHP attempts to find and load this configuration from a number of locations.; The following is a summary
阅读全文
摘要:function getConnection(){ @mysql_connect("localhost","username","password") or die("无法连接数据库"); @mysql_select_db("databasename") or die("未找到数据库"); }getConnection(); $query="select definition,accession,gi from birds_nucleotide order by d
阅读全文
摘要:文件目录:--index.php--php--data_info.phpindex.php这里要require_once类所在的php文件<?phprequire_once('./php/data_info.php'); $oneData=new user; $oneData->setName("username"); $oneData->setPassword("password"); echo $oneData->getName(); echo $oneData->getPassword();?>d
阅读全文
摘要:php textarea中的换行符为"\r\n"不是'\n'不是"<br />"不是'\r\n'不是'\r'+'\n'
阅读全文
摘要:本函数可能理论上说有些不地道,把utf-8的中文字符和char一视同仁,都按长度为1计算function string_substring($string,$start,$length) { $countstart=0; $countlength=0; $printstring=""; for($i=0;$i<strlen($string);$i++) { while($countstart<$start) { $countstart++; if(ord(substr($string,$i,1))>128) { $i+=3; } else{ $i++; }
阅读全文
摘要:PHP session 变量用于存储有关用户会话的信息,或更改用户会话的设置。Session 变量保存的信息是单一用户的,并且可供应用程序中的所有页面使用。理解:session用于单一用户与服务器的交互,每个用户的session都是不一样的。session作为全局变量,在浏览器开户期间所有页面内有效。Session 的工作机制是:为每个访问者创建一个唯一的 id (UID),并基于这个 UID 来存储变量。UID 存储在 cookie 中,亦或通过 URL 进行传导。在把用户信息存储到 PHP session 中之前,首先必须启动会话。注释:session_start() 函数必须位于 <
阅读全文
摘要:<?php $fileName=$_GET['file']; header('Content-type:application/force-download'); header('Content-Disposition:inline,filename='.$fileName); $fp=fopen("文件目录".$fileName, "r"); $content=fread($fp, filesize("文件目录".$fileName)); echo $content;?>
阅读全文
摘要:想看到函数返回的bool结果,但bool结果不能在浏览器输出怎么办?<?phpvar_dump(is_file('a_file.txt')) . "\n";var_dump(is_file('/usr/bin/')) . "\n";?>输出:bool(true)bool(false)
阅读全文
摘要:PHP substr strpos$pos=strpos("12345", "3");$substring=substr("12345", 0,$pos);echo $substring;输出:12JAVA subString indexofString str="12345";int pos=str.indexOf("3");String substring=str.substring(0, pos);System.out.println(substring);输出:12PHP 从最末一个&q
阅读全文
摘要:大体上这篇贴很简洁实用(本人喜欢把条条理理写的很漂亮的人,谢谢永福)转:PHP执行系统命令(简介及方法)在PHP中调用外部命令,可以用如下三种方法来实现:方法一:用PHP提供的专门函数(四个):PHP提供4个专门的执行外部命令的函数:exec(), system(), passthru(), shell_exec()1)exec()原型: string exec ( string $command [, array &$output [, int &$return_var ]] ) 说明: exec执行系统外部命令时不会输出结果,而是返回结果的最后一行。如果想得到结果,可以使用
阅读全文
摘要:matlab太大了,想导出一个可执行的文件,exe或jar或dll吧,然后用程序调用。我导出的exe,用php调用安装matlab,安装vc6编译器。没用过C++,下了个VC6.0安装了,系统就有vc6编译器了。Matlab命令行窗口:mex -setupmbuild -setup都选VC6M文件:funBt_fun.m随便一点了就function c= funBt_fun(input)c=input+1;Matlab命令窗口:cd XXX进入M文件所在路径mcc -m funBt_fun.m 进行编译生成funBt_fun.exePHP调用:$commandBt="E:/funBt
阅读全文
摘要:解决从Mysql读取中文时的乱码问题:建表时先加上default charset=utf8;插入中文数据之前(Mysql命令提示符下)是用set names gb2312;在php页面中设置是mysql_query('SET NAMES UTF8');在php页面(已设定为utf8后)中插入中文数据不会出现乱码,应该插入数据库的时候就是以utf8字符集插入中文数据的故不会出现问题!在php页面前面不要忘了加上header('content-type;text/html;charset=utf-8');大家在MySQL命令提示符下想查看数据,中文数据有可能是如下
阅读全文
浙公网安备 33010602011771号