博瑞博客

青春是一个充满活力的季节,即便是我们失去了天使的翅膀,只要我们还有一颗青春的心,那么我们的生活依然能够如阳光般灿烂!......
推荐阅读站长精心推荐阅读
现在位置:首页 > PHP
  • emlog pro 未注冊 无法发贴 怎么办

    emlog pro 未注冊 无法发贴 怎么办

    PHP  1-23  39浏览  0评论  

    方法一、付费注册 付费注册之后应该就不会跳转了。 方法二、修改代码 文件:admin\article.php 中查找如下代码。 $fields = []; if (!Register::isRegLocal() && $sta_cache['lognum'] > 50) { emDirect("auth.php?error_article=1"); } include View::getAdmView(User::haveEditPermission() ? 'header' : 'uc_header'); 将这几行代码注释或删除就可以了,以后发贴时就不会跳转了 $fields = []; /* if (!Register::isRegLocal() && $sta_cache['lognum'] > 50) { emDirect("auth.php?error_article=1"); } */ include View::getAdmView(User::haveEditPermission() ? 'header' : 'uc_header'); emlog pro 如果是免费开源程序,大家可以修改免费来用, 如果是付费程序,想用的话就去花钱够买吧! 转载请注明出处

  • emlog pro 如何去掉首页标题"未注冊的版本”字样

    emlog pro 如何去掉首页标题"未注冊的版本”字样

    PHP  1-23  27浏览  0评论  

    方法一、付费去掉 付费应该可以去掉 方法二、修改代码 文件: include\lib\option.php里,找下面这个函数 static function getAll() { $CACHE = Cache::getInstance(); $options_cache = $CACHE->readCache('options'); $options_cache['site_title'] = $options_cache['site_title'] ?: $options_cache['blogname']; $options_cache['site_description'] = $options_cache['site_description'] ?: $options_cache['bloginfo']; if (empty($options_cache['emkey'])) { $options_cache['site_title'] = '未注册的版本 ' . $options_cache['site_title']; } return $options_cache; } 注释或删除掉修改标题的几号行就可以了,改完如下 static function getAll() { $CACHE = Cache::getInstance(); $options_cache = $CACHE->readCache('options'); $options_cache['site_title'] = $options_cache['site_title'] ?: $options_cache['blogname']; $options_cache['site_description'] = $options_cache['site_description'] ?: $options_cache['bloginfo'];/* if (empty($options_cache['emkey'])) { $options_cache['site_title'] = '未注册的版本 ' . $options_cache['site_title']; }*/ return $options_cache; } emlog pro 如果是免费开源程序,大家可以修改免费来用, 如果是付费程序,想用的话就去花钱够买吧! 转载请注明出处

  • php遍历文件夹下所有文件

    php遍历文件夹下所有文件

    PHP  1-15  353浏览  0评论  

    /** * 遍历当前文件夹展示所有的文件和目录 */ function dirList($dir_path = '') { if(is_dir($dir_path)) { $dirs = opendir($dir_path); if($dirs) { while(($file = readdir($dirs)) !== false) { if($file !== '.' && $file !== '..') { if(is_dir($file)) { echo $dir_path . '/' . $file . '<br />'; dirList($dir_path . '/' . $file); } else { echo $dir_path . '/' . $file . '<br />'; } } } closedir($dirs); } } else { echo '目录不存在!'; } } dirList('/var/www/html/php-demo'); function dir_list($dir) { if(!is_dir($dir)) return false; $dir_list = array(); $opendir = opendir($dir); if($opendir) { while(($file = readdir($opendir)) !== false) { if($file !== '.' && $file !== '..') { $tem = $dir . '/' . $file; if(is_dir($tem)) { $dir_list[$tem . '/'] = $file . '/'; dir_list($tem); } else { $dir_list[] = $file; } } } closedir($opendir); return $dir_list; } } $dir = dir_list('/var/www/html/php-demo'); var_dump($dir); 运行结果:

  • PHP函数篇详解十进制、二进制、八进制和十六进制转换函数说明

    PHP函数篇详解十进制、二进制、八进制和十六进制转换函数说明

    PHP  2-28  1001浏览  0评论  

    一,十进制(decimal system)转换函数说明 1,十进制转二进制 decbin() 函数,如下实例 echo decbin(12); //输出 1100 echo decbin(26); //输出 11010 decbin (PHP 3, PHP 4, PHP 5) decbin -- 十进制转换为二进制

  • php获取当前时间的毫秒数的方法

    php获取当前时间的毫秒数的方法

    PHP  2-28  1022浏览  0评论  

    php本身没有提供返回毫秒数的函数,但提供了一个microtime()函数,借助此函数,可以很容易定义一个返回毫秒数的函数

  • 使用PHP进行UDP Socket编程

    使用PHP进行UDP Socket编程

    PHP  2-26  1124浏览  0评论  

    本文主要是通过简单的例子介绍下UDP Socket编程.

  • PHP的Socket通信之UDP篇

    PHP的Socket通信之UDP篇

    PHP  2-26  974浏览  0评论  

    1.创建一简单的UDP服务器 //服务器信息 $server = 'udp://127.0.0.1:9998'; //消息结束符号 $msg_eof = "\n"; $socket = stream_socket_server($server, $errno, $errstr, STREAM_SERVER_BIND); if (!$socket) { die("$errstr ($errno)"); } do { //接收客户端发来的信息 $inMsg = stream_socket_recvfrom($socket, 1024, 0, $peer); //服务端打印出相关信息 echo "Client : $peer\n"; echo "Receive : {$inMsg}"; //给客户端发送信息 $outMsg = substr($inMsg, 0, (strrpos($inMsg, $msg_eof))).' -- '.date("D M j H:i:s Y\r\n"); stream_socket_sendto($socket, $outMsg, 0, $peer); } while ($inMsg !== false); 2.简单的客户端 function udpGet($sendMsg = '', $ip = '127.0.0.1', $port = '9998'){ $handle = stream_socket_client("udp://{$ip}:{$port}", $errno, $errstr); if( !$handle ){ die("ERROR: {$errno} - {$errstr}\n"); } fwrite($handle, $sendMsg."\n"); $result = fread($handle, 1024); fclose($handle); return $result; } $result = udpGet('Hello World'); echo $result;                      

  • php socket通信(tcp/udp)

    php socket通信(tcp/udp)

    PHP  2-26  996浏览  0评论  

    注意    1.在socket_bind的时候ip地址不能真回环地址如127.0.0.1   2.server.php后台跑起来的时候 nohup php server.php > /var/tmp/a.log 2>&1 & 一: udp 方式 1) server.php   <?php //error_reporting( E_ALL ); set_time_limit( 0 ); ob_implicit_flush(); $socket = socket_create( AF_INET, SOCK_DGRAM, SOL_UDP ); if ( $socket === false ) { echo "socket_create() failed:reason:" . socket_strerror( socket_last_error() ) . "\n"; } $ok = socket_bind( $socket, '202.85.218.133', 11109 ); if ( $ok === false ) { echo "socket_bind() failed:reason:" . socket_strerror( socket_last_error( $socket ) ); } while ( true ) { $from = ""; $port = 0; socket_recvfrom( $socket, $buf,1024, 0, $from, $port ); echo $buf; usleep( 1000 ); } ?> 2)client.php   <?php $sock = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP); $msg = 'hello'; $len = strlen($msg); socket_sendto($sock, $msg, $len, 0, '202.85.218.133', 11109); socket_close($sock); ?>   一: TCP 方式 1)server.php <?php //error_reporting( E_ALL ); set_time_limit( 0 ); ob_implicit_flush(); $socket = socket_create( AF_INET, SOCK_STREAM, SOL_TCP ); socket_bind( $socket, '192.168.2.143', 11109 ); socket_listen($socket); $acpt=socket_accept($socket); echo "Acpt!\n"; while ( $acpt ) { $words=fgets(STDIN); socket_write($acpt,$words); $hear=socket_read($acpt,1024); echo $hear; if("bye\r\n"==$hear){ socket_shutdown($acpt); break; } usleep( 1000 ); } socket_close($socket) ?>   2) client.php   <?php $socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP); $con=socket_connect($socket,'192.168.2.143',11109); if(!$con){socket_close($socket);exit;} echo "Link\n"; while($con){ $hear=socket_read($socket,1024); echo $hear; $words=fgets(STDIN); socket_write($socket,$words); if($words=="bye\r\n"){break;} } socket_shutdown($socket); socket_close($sock); ?>

  • php 字符串与十六进制互转函数整理

    php 字符串与十六进制互转函数整理

    PHP  2-26  902浏览  0评论  

    php 字符串与十六进制互转函数代码: <?php function strToHex($string)//字符串转十六进制 { $hex=""; for($i=0;$i<strlen($string);$i++) $hex.=dechex(ord($string[$i])); $hex=strtoupper($hex); return $hex; } function hexToStr($hex)//十六进制转字符串 { $string=""; for($i=0;$i<strlen($hex)-1;$i+=2) $string.=chr(hexdec($hex[$i].$hex[$i+1])); return $string; } ?>

  • PHP socket 编程中的超时设置

    PHP socket 编程中的超时设置

    PHP  2-26  908浏览  0评论  

    PHP socket 编程中的超时设置.网上找了半天也没找到。贴出来分享之: 设置$socket 发送超时1秒,接收超时3秒: $socket = socket_create(AF_INET,SOCK_STREAM,SOL_TCP); socket_set_option($socket,SOL_SOCKET,SO_RCVTIMEO,array("sec"=>1, "usec"=>0 ) ); socket_set_option($socket,SOL_SOCKET,SO_SNDTIMEO,array("sec"=>3, "usec"=>0 ) );