技术文章

  • PHP 比较两个数组的值是否相等

    2011-06-28 21:04:00 25077 0 技术文章
    function compareArray() {
        $arr1 = array('a', 'b', 'c', 'd');
        $arr2 = array('d', 'c', 'b', 'a');
        sort($arr1);
        sort($arr2);
        return $arr1 == $arr2;
    }
    
    • Linux 中 grep 命令实现“或”条件

      2011-02-12 12:34:00 26526 0 技术文章

      \| 符号法

      # grep 'cui\|liang'
      

      使用多个 -e 参数

      # grep -e cui -e liang
      

      使用扩展 -E

      # grep -E "cui|liang"
      
    • CentOS 中 yum update 与 yum upgrade 的区别

      2010-12-23 12:31:10 26501 0 技术文章

      在 CentOS 系统中,yum upgradeyum update 都会将系统包更新到最新版本。

      通过 man yum 查询到的帮助信息如下:

      update

      If  run  without any packages, update will update every currently installed package.  If one or more packages or package globs are specified, Yum will only update the listed packages.  While updating packages, yum will ensure
      that all dependencies are satisfied. (See Specifying package names for more information) If the packages or globs specified match to packages which are not currently installed then update will not install them.  update  oper-
      ates on groups, files, provides and filelists just like the "install" command.
      
      If the main obsoletes configure option is true (default) or the --obsoletes flag is present yum will include package obsoletes in its calculations - this makes it better for distro-version changes, for example: upgrading from
      somelinux 8.0 to somelinux 9.
      
      Note that "update" works on installed packages first, and only if there are no matches does it look for available packages. The difference is most noticeable when you do "update foo-1-2" which will act exactly as "update foo"
      if foo-1-2 is installed. You can use the "update-to" if you’d prefer that nothing happen in the above case.
      

      upgrade

      Is the same as the update command with the --obsoletes flag set. See update for more details.
      

      唯一不同是:yum upgrade 会删除旧版本的 package,而 yum update 则会保留。注意!如果你的某些软件依赖旧版本的 package,请使用 yum update

    • HTTP状态码 : HTTP Status Code

      2010-12-03 11:12:30 26795 0 技术文章

      常见的状态码:

      HTTP: Status 200 – 服务器成功返回网页 HTTP: Status 404 – 请求的网页不存在 HTTP: Status 503 – 服务不可用

    • 执行yiic命令提示'php.exe'不是内部或外部命令...的解决方法

      2010-09-21 20:20:39 3057 0 技术文章

      这个问题困扰我好久,解决的方法是把 php.exe 这个目录加入系统环境变量,这样就不会提示这样的错误了!

      还有个问题就是每次执行 yiic 命令时要把 yiic 的全路径打出来才行,比如我的 Yii 框架在 e:/htdocs 里面,我每次执行的时候都要

      > e:/htdocs/yii/yiic webapp yiiblog
      

      我们可以把 yiic 也加入系统环境变量,加入以下代码:

      C:\php;E:\htdocs\yii\framework\
      

      此时我们执行 yiic 再不用打全路径了,这样方便多了。

      > yiic webapp yiiblog