`
leiyonglin
  • 浏览: 50120 次
  • 性别: Icon_minigender_1
  • 来自: 厦门
社区版块
存档分类
最新评论
文章列表
今天想写个扔骰子并统计点数概率的小程序,使用如下方法生成随机数 for ($j=0;$j<10000;$j++){ for($i=0;$i<6;$i++){ $tempArray[$i] = rand(1, 6); } $temp = array_count_values($tempArray); for ($i=1;$i<7;$i++){ isset($temp[$i])?0:$temp[$i]=0; } print_r($temp); } 最后发现无论进行多少次循环,始终不出现 6个4、6个5 , 6个3和6个6最常出现,不知道这是 ...
【TechWeb报道】8月16日消息,据国外媒体报道,谷歌昨晚宣布以125亿美元收购摩托罗拉移动,成为谷歌收购史上最昂贵的一笔。   过去10年谷歌收购的公司超过100家,以下历数其中最大的10笔收购:   1.dMarc Broadcasting 1.02亿 ...
[ 错误信息 ] exception 'Exception' with message 'The filename ../../Uploads/taobaoExcel/day_110815/201108151844517294.xls is not recognised as an OLE file' in E:\phpworks\apache\htdocs... 问题原因: 虽然该文件可能有一个xls扩展名,这是一个“假”的Excel文件。如果您在文本编辑器打开该文件你会发现它实际上是一个HTML文件。 我的原因是模版有错,我直接把Excel2007的后缀,xlsx改成xls,导致 ...
  利用phpExcel读取excel文件,读取出来的时间列出现5位数字,并不是想要的时间(不知道为啥),在网上搜了一个excelTime的函数可以正确转化时间 error_reporting(E_ALL); date_default_timezone_set('Asia/shanghai'); /** PHPExcel_IOFactory */ require_once '../Classes/PHPExcel/IOFactory.php'; $inputFileName = '6081076641077444758.xls'; $objReader = new PHPExcel ...
有的时候,能够调用可变参数的同一个方法会非常方便。PHP能够定义带默认值的可选参数使这一做法成为可能。 可以在php5中用__call()实现这种方法重载。下面来看一个示例。假设要用重载行为,那么要将其放到抽象父类中。 abstract class OverloadableObject{ function __call($name, $args){ $method = $name."_".count($args); if(!method_exists($this,$method)){ throw new ...
  去掉 X-Powered-By 只需要修改php.ini 中 expose_php = On 改成 expose_php = Off隐藏 Apache 版本信息,修改/etc/httpd/conf/httpd.conf ServerTokens Prod ServerSignature Off windows下修改conf/httpd.conf,如果没有这两行直接加到最后就行     ServerSignature指令允许您配置服务器端生成文档的页脚(错误信息、mod_proxy的ftp目录列表、mod_info的输出)。您启用这个页脚的原因主要在于处于一个代理服务 ...
转自:http://blog.csdn.net/21aspnet/article/details/6599777   php再调用json_decode从字符串对象生成json对象时,如果使用[]操作符取数据,会得到下面的错误错误:Cannot use object of type stdClass as array产生原因: $res=json_decode($res);$res['key'];//把json_decode()后的对象当作数组使用。 解决方法(2种):1、使用 json_decode($d, true)。就是使json_decode 的第二个变量设置为 tr ...
javascript中没有用于移除字符串头尾空白的原生修剪方法,这是其最明显的疏漏之一。最常见的trim函数实现如下:   <script type="text/javascript"> function trim(str){ //删除左右两端的空格 return str.replace(/(^\s*)|(\s*$)/g, ""); } function ltrim(str){ //删除左边的空格 return str.replace(/(^\s*)/g,""); } ...
直接在my.ini最后加上 #Enter a name for the binary log. Otherwise a default name will be used. #log-bin= #Enter a name for the query log file. Otherwise a default name will be used. #log= #Enter a name for the error log file. Otherwise a default name will be used. #log-error= #Enter a name for the upd ...
mod_deflate 模块提供了DEFLATE输出过滤器,允许服务器在将输出内容发送到客户端以前进行压缩,以节约带宽。   这是一个针对心急者的示范配置: 仅仅压缩少数几种类型 AddOutputFilterByType DEFLATE text/html text/plain text/xml 以下允许压缩更多内容的配置更加复杂。除非你明白所有的配置细节,否则请不要使用。 Compress everything except images <Location /># 插入过滤器SetOutputFilter DEFLATE# Netscape 4. ...
1、启用expires_module 模块 LoadModule expires_module modules/mod_expires.so 2、打开expires ExpiresActive On3、设置规则 # expire GIF images after a month in the client's cache ExpiresByType image/gif A2592000 ExpiresByType image/png A2592000 ExpiresByType image/jpeg A2592000 # HTML documents are good for ...
在 Yahoo 开发者网站上,Yahoo 提出了优化网站性能的N条规则(Best Practices for Speeding Up Your Web Site)。这些规则是:   1. 尽可能的减少 HTTP 的请求数(Minimize HTTP Requests) —— Tag: content   2. 使用 CDN(Use a Content Delivery Network) —— T ...
Global site tag (gtag.js) - Google Analytics