用了一段时间的wp系统感觉到甚是强大,什么都有。但是还有一些确定。 1、评论,只要你一开启原生的评论功能,那木你就完蛋了。马上就有灌水的一天不到 上百个评论总是有的。 解决:推荐使用 多说的评论插件,只要按着多说的步骤来申请就可以了。申请完成,修改一下wp里面的文件就 哦了。 步骤: 进入后台=》外观=》编辑 点进去 到页面后,在右侧找到 评论(commons.php)直接使用多说中的代码全部替…
第六周作业-数据结构-二叉查找树| FLY_DF
下文实现的是查找二叉树的节点删除功能,在删除节点的时候会有一下三种情形。 1)要删除的节点无子节点,此时,只要删除节点即可,删除它上一个节点的指向。 2)要删除的操作有一个子节点,此时,删除此节点,并将它上一个节点的指向,它的下一个节点。 3)要删除的操作有两个子节点 ,此时,删除此节点,并将它上一个节点的指向,它的右侧节点中最左下方的父节点中的先左后右节点。 [crayon-5ded071b5f…
完全平衡二叉树
第五周作业-JavaScript | FLY_DF
实现并完善图片延迟加载效果。要求: 1)实现基本效果 2)通过在地址栏添加参数?debug后,可以打印日志到控制台 3)日志包括当前未加装的图片数,以及图片全部加载完成后的提示信息 4)滚动条的每一次滚动,仅执行一次图片检查操作 5)图片完全加载后,接触滚动事件 <script> // 构建图片列表 var html = [] for (var i=0; i< 10; i++) …
第五周 javascript
第五周 javascript 布兰登·艾克 ECMAScript DOM BOM DOM document object 文档对象 BOM borwse 浏览器对象 数据类型 String Number Bool Object undefined Null 类型装换: 数据运算中: undefined 转为 NaN Null 转为 0 js运行的是事件驱动 根据 执…
HTTP-MYSQL
1、HTTP协议作业: 自己封装一个myfopen的方法,能够通过它去用 get , post , head 方法请求 , 并能根据不同的返回状态码给出不同的提示 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 4…
自己封装一个myfopen的方法, 能够通过它去用 get , post , head 方法请求
自己封装一个myfopen的方法, 能够通过它去用 get , post , head 方法请求 , 并能根据不同的返回状态码给出不同的提示
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 |
<?php /* * 自己封装一个myfopen的方法, * 能够通过它去用 get , post , head 方法请求 , * 并能根据不同的返回状态码给出不同的提示 **/ $url = "http://me.eluup.com/778.html"; $post = array('name' => 'post','url' => 'me.eluup.com'); $cookie = array('name' => 'cookie','url' => 'me.eluup.com'); $header = array('name' => 'header','url' => 'me.eluup.com'); $fetch_type_list = array('quest','content','header','status','all'); $fetch_type = $fetch_type_list[array_rand($fetch_type_list, 1)]; $data = myfopen($url, $post, $cookie, $header, $fetch_type); var_dump($data); function myfopen($url, $post = '', $cookie = '', $header = '', $fetch_type = 'content', $limit = 0, $bysocket = FALSE, $ip = '', $timeout = 15, $block = TRUE){ $fetch_type = strtolower($fetch_type); $fetch_type_list = array( 'quest','content','header','status','all' ); in_array($fetch_type, $fetch_type_list) || $fetch_type = 'content'; $respond_content = ''; $respond_header = array(); $matches = parse_url($url); ! isset($matches['host']) && $matches['host'] = ''; ! isset($matches['path']) && $matches['path'] = ''; ! isset($matches['query']) && $matches['query'] = ''; ! isset($matches['port']) && $matches['port'] = ''; $host = $matches['host']; $path = $matches['path'] ? $matches['path'] .($matches['query'] ? '?' . $matches['query'] : '') : '/'; $port = ! empty($matches['port']) ? $matches['port'] : 80; if ($post && function_exists('parse_post')) { $post = parse_post($post); } if ($header && function_exists('parse_header')) { $header = parse_header($header); } if ($cookie && function_exists('parse_post')) { $cookie = parse_post($cookie); } if ($post) { $out = "POST $path HTTP/1.0\r\n"; $out .= "Accept: */*\r\n"; // $out .= "Referer: $boardurl\r\n"; $out .= "Accept-Language: zh-cn\r\n"; $out .= "Content-Type: application/x-www-form-urlencoded\r\n"; $out .= "User-Agent: $_SERVER[HTTP_USER_AGENT]\r\n"; $out .= "Host: $host\r\n"; $out .= 'Content-Length: ' . strlen($post) . "\r\n"; $out .= "Connection: Close\r\n"; $out .= "Cache-Control: no-cache\r\n"; $out .= "Cookie: $cookie\r\n"; $header && $out .= $header . "\r\n"; $out .= "\r\n"; $out .= $post; } else { $out = "GET $path HTTP/1.0\r\n"; $out .= "Accept: */*\r\n"; // $out .= "Referer: $boardurl\r\n"; $out .= "Accept-Language: zh-cn\r\n"; $out .= "User-Agent: $_SERVER[HTTP_USER_AGENT]\r\n"; $out .= "Host: $host\r\n"; $out .= "Connection: Close\r\n"; $header && $out .= $header . "\r\n"; $out .= "Cookie: $cookie\r\n"; $header && $out .= $header . "\r\n"; $out .= "\r\n"; } if ('quest' == $fetch_type) { return $out; } if (function_exists('fsockopen')) { $fp = @fsockopen(($ip ? $ip : $host), $port, $errno, $errstr, $timeout); } elseif (function_exists('pfsockopen')) { $fp = @pfsockopen(($ip ? $ip : $host), $port, $errno, $errstr, $timeout); } else { $fp = false; } if (! $fp) { return ''; } else { stream_set_blocking($fp, $block); stream_set_timeout($fp, $timeout); @fwrite($fp, $out); $status = stream_get_meta_data($fp); $is_onec = TRUE; if (! $status['timed_out']) { while (! feof($fp)) { if (($line = @fgets($fp)) && ($line == "\r\n" || $line == "\n")) { break; } else { if ($is_onec) { $respond_status = explode(" ", substr($line, 0, strlen($line) - 2)); if ('status' == $fetch_type) { @fclose($fp); return $respond_status; } $is_onec = FALSE; } else { $cutpos = strpos($line, ":"); $respond_header[] = array( 'attr' => substr($line, 0, $cutpos), 'val' => substr($line, $cutpos + 2, strlen($line) - 4 - $cutpos) ); } } } if ('header' == $fetch_type) { @fclose($fp); return $respond_header; } $stop = false; while (! feof($fp) && ! $stop) { $data = fread($fp, ($limit == 0 || $limit > 8192 ? 8192 : $limit)); $respond_content .= $data; if ($limit) { $limit -= strlen($data); $stop = $limit <= 0; } } } @fclose($fp); if ('content' == $fetch_type) { @fclose($fp); return $respond_content; } // 'all' == $fetch_type return array( $respond_status,$respond_header,$respond_content ); } } function parse_post($post){ $post_str = ''; if (is_array($post)) { foreach ($post as $attr => $val) { if (is_array($val)) { foreach ($val as $sub_attr => $sub_val) { $post_str .= sprintf("%s[%s]=%s&", urlencode($attr), urlencode($sub_attr), urlencode($sub_val)); } } else { $post_str .= sprintf("%s=%s&", urlencode($attr), urlencode($val)); } } } return $post_str ? $post_str : $post; } function parse_header($header, $val_callback = 'urlencode'){ $header_str = ''; if (is_array($header)) { foreach ($header as $attr => $val) { $header_str .= sprintf("%s: %s\r\n", $val_callback($attr), $val_callback($val)); } } return $header_str ? $header_str : $header; } |
第四周MYSQL(待整理)
MYSQL 问题一: 1、什么是体系结构 部件 部件之间的联系。 mysql的部件 1、Connectors:mysql的客户端[各种语言,类似会员中心] 2、Connection Pools:mysql 验证合法、进程资源的建立、检索连接数量、验证权限、缓存池 3、SQL intertace:sql接口 4、Parser:mysql解析 5、Optimizer:优化 6、Caches &…
第四周HTTP(待整理)
http协议 硬件 软件 端口 ;信息交换 处理能力 的 节点;建立的规则、约定、标准 一、php对Http协议能做的事情 一共7个 1、手动设置 http 返回错误码 header(‘HTTP/1.0 404 not Found’); 2、页面抓取方法 curl fpen file_get_content 3、设置编码 header(“content-type…
使用js动态加载页面内容
有一种情况页面会经常白页或是连接超时。 这个原因可能是用户访问的页面有很多业务逻辑,处理过程消耗时间较长,PHP处理超时。 类似这种,有两种方式解决 1、调整php的超时时间 2、在php处理时,把部分业务处理拆分出来。现将部分框架内容呈现给用户。然后使用<script src=”处理业务的php请求路径”><script> 对应的php处理,然后将…