Uninote
Uninote
用户根目录
每日点滴

<!DOCTYPE html> <html><head><meta http-equiv='Content-Type' content='text/html; charset=utf8'><title>mynote todo misc</title> <script> var g_resRoot = '../../__res/'; var g_json_outline = '{"children":[{"children":[],"level":1,"lvNumber":"1","text":"mynote 瘦身;vendor清理"},{"children":[],"level":1,"lvNumber":"2","text":"mynote sync 同步"},{"children":[],"level":1,"lvNumber":"3","text":"<!doctype html> head 添加"},{"children":[],"level":1,"lvNumber":"4","text":"id 代替path"},{"children":[],"level":1,"lvNumber":"5","text":"上线前todo"},{"children":[],"level":1,"lvNumber":"6","text":"上线前todo 2"},{"children":[],"level":1,"lvNumber":"7","text":"2018-10 整理"},{"children":[],"level":1,"lvNumber":"8","text":"gogs todo"},{"children":[],"level":1,"lvNumber":"9","text":"短信"},{"children":[],"level":1,"lvNumber":"10","text":"前后分离"},{"children":[],"level":1,"lvNumber":"11","text":"规范 review"},{"children":[],"level":1,"lvNumber":"12","text":"mynote codetracker/ct error"},{"children":[],"level":1,"lvNumber":"13","text":"实习 todo"},{"children":[],"level":1,"lvNumber":"14","text":"mynote todo tnds"},{"children":[],"level":1,"lvNumber":"15","text":"markdown 转纯文本有问题"},{"children":[],"level":1,"lvNumber":"16","text":"微信公众号 掘金等一键发布 selenium"},{"children":[],"level":1,"lvNumber":"17","text":"提醒工具 todo list"},{"children":[],"level":1,"lvNumber":"18","text":"【干货】Chrome插件(扩展)开发全攻略 大纲生成器 uoutline extension"}],"level":0,"lvNumber":"","text":"mynote todo misc"}'; </script> <link rel='stylesheet' type='text/css' href='../../__res/common.css'><style>.s0{color:#000000;} .s1{color:#000000;} .s2{color:#000080;} .s3{color:#000000;} .s4{color:#660e7a;} .s5{color:#808080;} .s6{color:#000000;} .s7{color:#0000ff;} .s8{color:#000000;} .s9{color:#0000ff;} .s10{color:#000000;} .s11{color:#660000;} .s12{color:#660000;} .s13{color:#000000;} .s14{color:#0000ff;} .s15{color:#008000;} .s16{color:#0000ff;} .s17{color:#000000;} .s18{color:#000080;} .s19{color:#660000;} .s20{color:#008000;} .s21{color:#660e7a;} .s22{color:#808080;} .s23{color:#000000;} .s24{color:#808080;} .s25{color:#c80000;} .s26{color:#000000;} .s27{color:#000000;} .s28{color:#0000ff;} .s29{color:#c80000;} </style> </head><body> <script src='../../__res/util.js'></script><div id='outline'> <li><a href='#ol_0' style='font-weight:bold; font-size:22px'>mynote todo misc</a></li> <li> <a href='#ol_1' >mynote 瘦身;vendor清理</a></li> <li> <a href='#ol_2' >mynote sync 同步</a></li> <li> <a href='#ol_3' ><!doctype html> head 添加</a></li> <li> <a href='#ol_4' >id 代替path</a></li> <li> <a href='#ol_5' >上线前todo</a></li> <li> <a href='#ol_6' >上线前todo 2</a></li> <li> <a href='#ol_7' >2018-10 整理</a></li> <li> <a href='#ol_8' >gogs todo</a></li> <li> <a href='#ol_9' >短信</a></li> <li> <a href='#ol_10' >前后分离</a></li> <li> <a href='#ol_11' >规范 review</a></li> <li> <a href='#ol_12' >mynote codetracker/ct error</a></li> <li> <a href='#ol_13' >实习 todo</a></li> <li> <a href='#ol_14' >mynote todo tnds</a></li> <li> <a href='#ol_15' >markdown 转纯文本有问题</a></li> <li> <a href='#ol_16' >微信公众号 掘金等一键发布 selenium</a></li> <li> <a href='#ol_17' >提醒工具 todo list</a></li> <li> <a href='#ol_18' >【干货】Chrome插件(扩展)开发全攻略 大纲生成器 uoutline extension</a></li> </div>

<pre id='ol_0' class='title'>mynote todo misc</pre> <pre><d class='s0'><a href='mynote_tnds.html'>mynote tnds </a></d></pre> <pre><d class='s0'></d></pre> <h1 id='ol_1'>mynote 瘦身;vendor清理</h1> <pre><d class='s1'>E:\uninote\mynote\basic\vendor\composer\autoload_static.php</d></pre> <pre><d class='s2'>class </d><d class='s3'>ComposerStaticInit90933ea8c1501994af4c881c90cd1926</d></pre> <pre><d class='s3'>{</d></pre> <pre><d class='s3'> </d><d class='s2'>public static </d><d class='s4'>$files </d><d class='s3'>= </d><d class='s2'>array </d><d class='s3'>(</d></pre> <pre><d class='s5'>// '0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => DIR . '/..' . '/symfony/polyfill-mbstring/bootstrap.php',</d></pre> <pre><d class='s5'>// '2cffec82183ee1cea088009cef9a6fc3' => DIR . '/..' . '/ezyang/htmlpurifier/library/HTMLPurifier.composer.php',</d></pre> <pre><d class='s5'>// '6124b4c8570aa390c21fafd04a26c69f' => DIR . '/..' . '/myclabs/deep-copy/src/DeepCopy/deep_copy.php',</d></pre> <pre><d class='s5'>// '2c102faa651ef8ea5874edb585946bce' => DIR . '/..' . '/swiftmailer/swiftmailer/lib/swift_required.php',</d></pre> <pre><d class='s5'>// 'a0edc8309cc5e1d60e3047b5df6b7052' => DIR . '/..' . '/guzzlehttp/psr7/src/functions_include.php',</d></pre> <pre><d class='s5'>// '180092cfc969a12e06f2132a203a3184' => DIR . '/..' . '/codeception/verify/src/Codeception/function.php',</d></pre> <pre><d class='s5'> </d><d class='s3'>);</d></pre> <pre><d class='s0'></d></pre> <h1 id='ol_2'>mynote sync 同步</h1> <pre><d class='s0'>E:\uninote\mynote_res\mynote\edam-sync.pdf</d></pre> <pre><d class='s0'></d></pre> <t id='4f0a4828-6b59-4bd0-baeb-53ff385454f4'> <pre class='tnd_head'>lv1=mynote lv2= type=todo</pre> <h1 id='ol_3'><!doctype html> head 添加</h1> <pre><d class='s6'>客户端</d><d class='s7'></d></pre> </t> <pre><d class='s0'></d></pre> <t id='fd083a9e-ab58-4263-9253-17de3cad53b2'> <pre class='tnd_head'>lv1=mynote lv2= type=todo</pre> <h1 id='ol_4'>id 代替path</h1> <pre><d class='s1'>comment.article_id 变成了真正的id</d></pre> <pre><d class='s1'>中文问题</d></pre> <pre><d class='s1'>前端不再需要path</d></pre> <pre><d class='s1'>没有完成,有残留</d></pre> <pre><d class='s1'>变量命名规范 p</d></pre> <pre><d class='s8'></d></pre> <pre><d class='s9'>basename test;setlocale 在linux下无效</d></pre> <pre><d class='s9'></d></pre> <pre><d class='s10'>phpstorm声明$</d><d class='s11'>maxlen</d><d class='s12'>默认值</d><d class='s10'>为null,但传入null却无法读取内容:</d><d class='s3'></d></pre> <pre><d class='s13'>file_get_contents(</d><d class='s11'>$path</d><d class='s3'>, </d><d class='s2'>null</d><d class='s3'>, </d><d class='s2'>null</d><d class='s3'>, -</d><d class='s14'>1</d><d class='s3'>);</d></pre> <pre><d class='s13'>file_get_contents(</d><d class='s11'>$path</d><d class='s3'>, </d><d class='s2'>null</d><d class='s3'>, </d><d class='s2'>null</d><d class='s3'>, </d><d class='s10'>null</d><d class='s3'>);</d></pre> <pre><d class='s2'>function </d><d class='s3'>file_get_contents (</d><d class='s11'>$filename</d><d class='s3'>, </d><d class='s11'>$flags </d><d class='s3'>= </d><d class='s2'>null</d><d class='s3'>, </d><d class='s11'>$context </d><d class='s3'>= </d><d class='s2'>null</d><d class='s3'>, </d><d class='s11'>$offset </d><d class='s3'>= </d><d class='s2'>null</d><d class='s3'>, </d><d class='s11'>$maxlen </d><d class='s3'>= </d><d class='s2'>null</d><d class='s3'>) {}</d></pre> <pre><d class='s9'></d></pre> <pre><d class='s13'>$(</d><d class='s15'>"#path"</d><d class='s3'>)</d><d class='s10'> 不再需要</d></pre> <pre><d class='s3'>checkout_content</d><d class='s10'> 不再需要</d></pre> <pre><d class='s3'>path_for_aid</d><d class='s10'> 不再需要</d></pre> </t> <pre><d class='s0'></d></pre> <t id='6f5ba1a3-969a-475f-8968-13d209f621f3'> <pre class='tnd_head'>lv1= lv2= type=</pre> <h1 id='ol_5'>上线前todo</h1> <pre><d class='s8'></d></pre> <pre><d class='s8'>if (YII_ENV_DEV) {</d></pre> <pre><d class='s8'> // configuration adjustments for 'dev' environment</d></pre> <pre><d class='s8'> $config['bootstrap'][] = 'debug';</d></pre> <pre><d class='s8'> $config['modules']['debug'] = [</d></pre> <pre><d class='s8'> 'class' => 'yii\debug\Module',</d></pre> <pre><d class='s8'> // uncomment the following to add your IP if you are not connecting from localhost.</d></pre> <pre><d class='s8'> 'allowedIPs' => ['127.0.0.1', '::1', '120.78.153.202'],</d></pre> <pre><d class='s8'> ];</d></pre> <pre><d class='s8'></d></pre> <pre><d class='s8'>actionLike 这个不能取消(uid不需要传,直接用就是了):</d></pre> <pre><d class='s8'> if ($uid != $_SESSION['user_id']) {</d></pre> <pre><d class='s8'> return ResponseTools::return_error(ResponseCode::USER_ID_ERROR);</d></pre> <pre><d class='s8'> }</d></pre> <pre><d class='s8'></d></pre> <pre><d class='s8'>已经初始化了,不必再判断:</d></pre> <pre><d class='s2'>public function </d><d class='s3'>init()</d></pre> <pre><d class='s3'>{</d></pre> <pre><d class='s3'> CT(</d><d class='s15'>"app/controllers/api/common/BaseController.init(){}"</d><d class='s3'>);</d></pre> <pre><d class='s3'> </d><d class='s11'>$this</d><d class='s3'>-></d><d class='s4'>req </d><d class='s3'>= \Yii::</d><d class='s4'>$app</d><d class='s3'>-></d><d class='s4'>request</d><d class='s3'>;</d></pre> <pre><d class='s1'>request 包含get、post?</d></pre> <pre><d class='s1'></d></pre> <pre><d class='s8'>没有参数为啥要post?</d></pre> <pre><d class='s8'> public function actionCount()</d></pre> <pre><d class='s8'> {</d></pre> <pre><d class='s8'> if (!empty($_POST)) {</d></pre> <pre><d class='s8'></d></pre> <pre><d class='s8'>@throws \yii\db\Exception</d></pre> <pre><d class='s8'></d></pre> <pre><d class='s8'> </d><d class='s5'>* @throws \yii\db\StaleObjectException</d></pre> <pre><d class='s5'> /</d></pre> <pre><d class='s2'>public function </d><d class='s3'>picUpdate(</d><d class='s11'>$userId</d><d class='s3'>, </d><d class='s11'>$base64</d><d class='s3'>, &</d><d class='s11'>$errno </d><d class='s3'>= </d><d class='s14'>0</d><d class='s3'>)</d></pre> <pre><d class='s3'></d></pre> <pre><d class='s2'>public function </d><d class='s3'>addPv(</d><d class='s11'>$aid</d><d class='s3'>, </d><d class='s11'>$uid</d><d class='s3'>, </d><d class='s11'>$ip</d><d class='s3'>, </d><d class='s11'>$referer</d><d class='s3'>, &</d><d class='s11'>$errno </d><d class='s3'>= </d><d class='s14'>0</d><d class='s3'>)</d></pre> <pre><d class='s8'></d></pre> <pre><d class='s2'>public function </d><d class='s3'>getArtLikeNum(</d><d class='s11'>$aid</d><d class='s3'>)</d></pre> <pre><d class='s3'></d></pre> <pre><d class='s8'>逐渐脱离框架</d></pre> <pre><d class='s8'></d></pre> <pre><d class='s8'>对比:</d></pre> <pre><d class='s2'>private function </d><d class='s3'>_checkout_for_like_repeat(</d><d class='s11'>$ids</d><d class='s3'>)</d></pre> <pre><d class='s2'>public function </d><d class='s3'>checkoutForLikeRepeat(</d><d class='s11'>$uid</d><d class='s3'>, </d><d class='s11'>$aid</d><d class='s3'>)</d></pre> <pre><d class='s8'></d></pre> <pre><d class='s8'>??</d></pre> <pre><d class='s2'>use function </d><d class='s3'>PHPSTORM_META\type;</d></pre> <pre><d class='s8'></d></pre> <pre><d class='s8'></d></pre> <pre><d class='s8'>use app\lib\ResponseTools;</d></pre> <pre><d class='s8'></d></pre> <pre><d class='s8'> if (!$arr) {</d></pre> <pre><d class='s8'> $errno = ResponseCode::NOT_HAVE_USER;</d></pre> <pre><d class='s8'> // TODO: 记录日志,而非返回错误,前端无法(不)处理</d></pre> <pre><d class='s8'> }</d></pre> <pre><d class='s8'></d></pre> <pre><d class='s8'>// return ResponseTools::return_error(ResponseCode::NOT_HAVE_USER, null, false);</d></pre> <pre><d class='s8'> return ResponseTools::return_error(0, $arr, true);</d></pre> <pre><d class='s8'></d></pre> <pre><d class='s8'>轮播图获取失败</d></pre> <pre><d class='s8'>保存文件时发现working dir not clean</d></pre> <pre><d class='s8'></d></pre> <pre><d class='s8'>部分可用如何处理?</d></pre> <pre><d class='s8'></d></pre> <pre><d class='s8'>需要同时支持curl方式获取,session问题?fe server不维护session,仅做转发功能</d></pre> <pre><d class='s1'>如何确保session_start至多只调用一次?</d></pre> <pre><d class='s1'></d></pre> <pre><d class='s1'>每个请求都要初始化这些,完全没必要</d></pre> <pre><d class='s2'>public function </d><d class='s3'>init()</d></pre> <pre><d class='s3'>{</d></pre> <pre><d class='s3'> CT(</d><d class='s15'>"app/controllers/common/BaseController.init(){}"</d><d class='s3'>);</d></pre> <pre><d class='s3'> </d><d class='s11'>$this</d><d class='s3'>-></d><d class='s4'>req </d><d class='s3'>= \Yii::</d><d class='s4'>$app</d><d class='s3'>-></d><d class='s4'>request</d><d class='s3'>;</d></pre> <pre><d class='s3'> </d><d class='s11'>$this</d><d class='s3'>-></d><d class='s4'>api_url </d><d class='s3'>= \Yii::</d><d class='s4'>$app</d><d class='s3'>-></d><d class='s4'>api</d><d class='s3'>-></d><d class='s4'>api_url</d><d class='s3'>;</d></pre> <pre><d class='s3'> </d><d class='s11'>$this</d><d class='s3'>-></d><d class='s4'>curl_model </d><d class='s3'>= </d><d class='s2'>new </d><d class='s3'>Curl();</d></pre> <pre><d class='s3'> </d><d class='s11'>$this</d><d class='s3'>-></d><d class='s4'>com </d><d class='s3'>= </d><d class='s2'>new </d><d class='s3'>Com();</d></pre> <pre><d class='s7'></d></pre> </t> <pre><d class='s16'></d></pre> <t id='ffc4891e-70e0-43ce-8911-096f0fd42508'> <pre class='tnd_head'>lv1= lv2= type=</pre> <h1 id='ol_6'>上线前todo 2</h1> <pre><d class='s1'></d></pre> <pre><d class='s2'>protected function </d><d class='s3'>internalExecute(</d><d class='s11'>$rawSql</d><d class='s3'>)</d></pre> <pre><d class='s1'></d></pre> <pre><d class='s1'>这是干啥?</d></pre> <pre><d class='s2'>if </d><d class='s3'>(!</d><d class='s11'>$rs_arr</d><d class='s3'>[</d><d class='s15'>'status'</d><d class='s3'>]) {</d></pre> <pre><d class='s3'> slog(</d><d class='s15'>"[save sql] - </d><d class='s2'>\n</d><d class='s3'>{</d><d class='s11'>$rs_arr</d><d class='s3'>[</d><d class='s15'>'data'</d><d class='s3'>]}</d><d class='s2'>\n</d><d class='s15'> - SQL statement has no influence on rows.</d><d class='s2'>\n</d><d class='s15'>"</d><d class='s3'>);</d></pre> <pre><d class='s3'>}</d></pre> <pre><d class='s1'></d></pre> <pre><d class='s1'>传路径要验证,不能超出用户目录范围。</d></pre> <pre><d class='s1'></d></pre> <pre><d class='s1'>errno直接返回到数组中,status逻辑重复。如md.php</d></pre> <pre><d class='s1'></d></pre> <pre><d class='s1'>md.php, init时就确定了:</d></pre> <pre><d class='s1'>$_SESSION['web']['user_info']['username']</d></pre> <pre><d class='s1'></d></pre> <pre><d class='s1'>actionRename 这里面的文件是否存在需要放在_git_op_lock中,因为可能需要切换版本,并且要在锁中进行。</d></pre> <pre><d class='s1'>_db_save_md 新建、编辑分离,就不要insert ... ON DUPLICATE KEY UPDATE 这种了</d></pre> <pre><d class='s1'></d></pre> <pre><d class='s1'>错误:</d></pre> <pre><d class='s4'>url</d><d class='s3'>: </d><d class='s4'>api_url </d><d class='s3'>+ </d><d class='s15'>'/markdown/version'</d><d class='s3'>,</d></pre> <pre><d class='s1'></d></pre> <pre><d class='s1'>var st = $(this).attr('disabled') || true;</d></pre> <pre><d class='s17'>6e641acece98335aa43b3d2c0b5459c1f128cafd</d></pre> <pre><d class='s1'></d></pre> <t id='6ace7147-f737-4776-8cc8-7b63063c58bb'> <pre class='tnd_head'>lv1= lv2= type=</pre> <h1 id='ol_7'>2018-10 整理</h1> </t> <pre><d class='s6'></d></pre> <pre><d class='s6'>为啥传入uid?</d></pre> <pre><d class='s6'>\app\logic\ArticleLogic::info</d></pre> <pre><d class='s6'></d></pre> <pre><d class='s6'>yii中,1068799191这个被自动识别为id:</d></pre> <pre><d class='s6'>http://localhost:222/book/1068799191</d></pre> <pre><d class='s6'>E:\uninote\mynote\basic\controllers\BookController.php</d></pre> <pre><d class='s6'>public function actionIndex()</d></pre> <pre><d class='s6'>{</d></pre> <pre><d class='s6'> // </d><d class='s10'>接收请求</d><d class='s6'></d></pre> <pre><d class='s6'> if ($this->req) {</d></pre> <pre><d class='s6'> $username = $this->req->get('id',FALSE);// </d><d class='s10'>用户唯一标示</d><d class='s6'></d></pre> <pre><d class='s6'> }</d></pre> <pre><d class='s6'></d></pre> <pre><d class='s6'></d></pre> <pre><d class='s6'>actionArticle_info 通过article_info访问</d></pre> <pre><d class='s6'></d></pre> <pre><d class='s6'>共享ajax controller?</d></pre> <pre><d class='s6'></d></pre> <pre><d class='s6'>也封装为logic:</d></pre> <pre><d class='s6'>// </d><d class='s10'>获取</d><d class='s6'> user_id</d></pre> <pre><d class='s6'>if ($this->is_login_bool) {</d></pre> <pre><d class='s6'> $uid = $SESSION['web']['user_id'];</d></pre> <pre><d class='s6'>} else {</d></pre> <pre><d class='s6'> $uid = NULL;</d></pre> <pre><d class='s6'>}</d></pre> <pre><d class='s6'></d></pre> <pre><d class='s6'></d></pre> <pre><d class='s18'>public static function </d><d class='s10'>return_error(</d><d class='s19'>$errno</d><d class='s10'>, </d><d class='s19'>$data </d><d class='s10'>= </d><d class='s20'>''</d><d class='s10'>, </d><d class='s19'>$status </d><d class='s10'>= </d><d class='s18'>false</d><d class='s10'>)</d></pre> <pre><d class='s10'>{</d></pre> <pre><d class='s10'> </d><d class='s18'>return </d><d class='s10'>[</d><d class='s20'>'errno' </d><d class='s10'>=> </d><d class='s19'>$errno</d><d class='s10'>, </d><d class='s20'>'data' </d><d class='s10'>=> </d><d class='s19'>$data</d><d class='s10'>, </d><d class='s20'>'status' </d><d class='s10'>=> </d><d class='s19'>$status</d><d class='s10'>];</d></pre> <pre><d class='s10'>}</d></pre> <pre><d class='s6'></d></pre> <pre><d class='s3'></d></pre> <pre><d class='s6'>curl_error curl_errno</d></pre> <pre><d class='s6'>http status code & response</d></pre> <pre><d class='s6'>build query 不调用?</d></pre> <pre><d class='s6'>file传递?</d></pre> <pre><d class='s6'>超时时间</d></pre> <pre><d class='s6'></d></pre> <pre><d class='s6'>CURLOPT_HEADER 决定是否返回header,但即使为false,也可以获取http code</d></pre> <pre><d class='s6'>CURLOPT_RETURNTRANSFER 一般都为true,返回而非直接print</d></pre> <pre><d class='s6'><a href='http://php.net/manual/en/function.curl-setopt.php'>http://php.net/manual/en/function.curl-setopt.php</a></d></pre> <pre><d class='s6'></d></pre> <pre><d class='s6'>curl_setopt_array</d></pre> <pre><d class='s6'></d></pre> <pre><d class='s18'>public static function </d><d class='s10'>proxy_logic(</d><d class='s19'>$class</d><d class='s10'>, </d><d class='s19'>$method</d><d class='s10'>, </d><d class='s19'>$args</d><d class='s10'>)</d></pre> <pre><d class='s10'></d></pre> <pre><d class='s6'>// 从model取数据,再根据status设置errno:</d></pre> <pre><d class='s18'>public function </d><d class='s10'>getArticleContent(</d><d class='s19'>$article_id</d><d class='s10'>)</d></pre> <pre><d class='s10'>{</d></pre> <pre><d class='s10'> </d><d class='s18'>if </d><d class='s10'>(!</d><d class='s19'>$article_id</d><d class='s10'>) {</d></pre> <pre><d class='s10'> </d><d class='s18'>return </d><d class='s10'>ResponseTools::return_error(ResponseCode::</d><d class='s21'>NOT_HAVE_ARTICLE_UNIQUE</d><d class='s10'>);</d></pre> <pre><d class='s10'> }</d></pre> <pre><d class='s10'></d></pre> <pre><d class='s10'> </d><d class='s19'>$article_model </d><d class='s10'>= </d><d class='s18'>new </d><d class='s10'>Article();</d></pre> <pre><d class='s10'></d></pre> <pre><d class='s10'> </d><d class='s22'>// 通过 username path 查询出所有文章内容</d><d class='s5'></d></pre> <pre><d class='s22'> </d><d class='s19'>$data </d><d class='s10'>= </d><d class='s19'>$article_model</d><d class='s10'>->show_content(</d><d class='s19'>$article_id</d><d class='s10'>);</d></pre> <pre><d class='s10'> </d><d class='s19'>$data</d><d class='s10'>[</d><d class='s20'>'status'</d><d class='s10'>] ? </d><d class='s19'>$data</d><d class='s10'>[</d><d class='s20'>'errno'</d><d class='s10'>] = </d><d class='s20'>'' </d><d class='s10'>: </d><d class='s19'>$data</d><d class='s10'>[</d><d class='s20'>'errno'</d><d class='s10'>] = </d><d class='s19'>$article_model</d><d class='s10'>-></d><d class='s21'>errno</d><d class='s10'>;</d></pre> <pre><d class='s10'> </d><d class='s18'>return </d><d class='s19'>$data</d><d class='s10'>;</d></pre> <pre><d class='s6'></d></pre> <pre><d class='s6'>logic的status是内部的,还是外部的?</d></pre> <pre><d class='s6'></d></pre> <pre><d class='s6'>php reflection</d></pre> <pre><d class='s6'></d></pre> <pre><d class='s6'>curl error:端口错误 ip错误 超时</d></pre> <pre><d class='s6'></d></pre> <pre><d class='s6'>errno:api返回的,用于api排查错误的</d></pre> <pre><d class='s6'></d></pre> <pre><d class='s6'>X:\project\visual studio projects\findhelper\codeviewer\Test\GrammarParserTests_out\idcard.php</d></pre> <pre><d class='s6'></d></pre> <pre><d class='s6'>CTInsert 前不再 CTRemove</d></pre> <pre><d class='s6'></d></pre> <pre><d class='s6'>修改删除的逻辑:</d></pre> <pre><d class='s6'>old:函数定义开始处,第一个非空的内容如果是CT,则一直查找到";",删除之</d></pre> <pre><d class='s6'>new:函数定义开始处,一直找到";",生成字符串,去匹配removePattern,如果成功,删除之</d></pre> <pre><d class='s6'></d></pre> <pre><d class='s6'></d></pre> <pre><d class='s18'>if</d><d class='s10'>(</d><d class='s18'>isset</d><d class='s10'>(\Yii::</d><d class='s21'>$app</d><d class='s10'>-></d><d class='s21'>api</d><d class='s10'>-></d><d class='s21'>api_proxy_url</d><d class='s10'>)) { </d><d class='s18'>return </d><d class='s10'>\app\logic\CommonLogic::proxy_logic(</d><d class='s21'>CLASS</d><d class='s10'>, </d><d class='s21'>METHOD</d><d class='s10'>, func_get_args()); }</d></pre> <pre><d class='s6'></d></pre> <pre><d class='s6'>注意移除\app\logic\CommonLogic::proxy_logic自身的proxy</d></pre> <pre><d class='s6'></d></pre> <pre><d class='s6'>登录返回:</d></pre> <pre><d class='s6'><img src='..\pic\63e2a720b6e5ded6ab5a5acd6d45e8ab.jpg' /></d><d class='s6'></d></pre> <pre><d class='s6'>$</d><d class='s19'>user_logic</d><d class='s10'>->getuserinfoto 返回,多了num,用户文章数(何时使用??):</d><d class='s3'></d></pre> <pre><d class='s3'><img src='..\pic\e83fa3ffd5cb90aafac53058c5b1f06b.jpg' /></d><d class='s6'></d></pre> <pre><d class='s6'></d></pre> <pre><d class='s6'>限制$_session的滥用</d></pre> <pre><d class='s6'></d></pre> <pre><d class='s6'>移除,好像没用了:</d></pre> <pre><d class='s22'>/ @describe 接口:更新用户session</d></pre> <pre><d class='s22'> * @return 输出请求结果</d></pre> <pre><d class='s22'> * /</d></pre> <pre><d class='s18'>public function </d><d class='s10'>actionUpdate_user_session()</d></pre> <pre><d class='s10'>{</d></pre> <pre><d class='s10'> </d><d class='s19'>$user_id </d><d class='s10'>= </d><d class='s19'>$this</d><d class='s10'>-></d><d class='s21'>req</d><d class='s10'>->post(</d><d class='s20'>'id'</d><d class='s10'>, </d><d class='s18'>FALSE</d><d class='s10'>);</d></pre> <pre><d class='s10'> </d><d class='s19'>$this</d><d class='s10'>->update_user_session(</d><d class='s19'>$user_id</d><d class='s10'>);</d></pre> <pre><d class='s10'> </d><d class='s18'>echo </d><d class='s10'>json_encode([</d><d class='s20'>'info'</d><d class='s10'>=></d><d class='s20'>'更新用户session完毕。'</d><d class='s10'>]);</d></pre> <pre><d class='s10'>}</d></pre> <pre><d class='s6'></d></pre> <pre><d class='s6'>update..session.. 整理,id是多余的</d></pre> <pre><d class='s6'></d></pre> <pre><d class='s6'></d></pre> <pre><d class='s6'></d></pre> <pre><d class='s6'>remove:已登录,更新用户session </d></pre> <pre><d class='s6'></d></pre> <pre><d class='s22'>前后端同步登陆session</d><d class='s5'></d></pre> <pre><d class='s6'></d></pre> <pre><d class='s6'>removed:</d></pre> <pre><d class='s6'> /</d></pre> <pre><d class='s6'> * @describe 向后台发送同步登陆session </d></pre> <pre><d class='s6'> * @return NULL</d></pre> <pre><d class='s6'> */ </d></pre> <pre><d class='s6'> private function _synchrodata()</d></pre> <pre><d class='s6'> {</d></pre> <pre><d class='s6'> $msign = $this->com->AES($_SESSION["web"]["user_info"]);</d></pre> <pre><d class='s6'> $param = array('id'=>$_SESSION["web"]["user_id"],'data'=>$msign);</d></pre> <pre><d class='s6'> $url = "/user/synchrodata";</d></pre> <pre><d class='s6'> $this->curl_model->http_post($this->api_url.$url,$param);</d></pre> <pre><d class='s6'> }</d></pre> <pre><d class='s6'> /**</d></pre> <pre><d class='s6'> * @function </d></pre> <pre><d class='s6'> * @deprecated</d></pre> <pre><d class='s6'> * @param $url String api地址</d></pre> <pre><d class='s6'> * @param $param Array/String 请求的参数</d></pre> <pre><d class='s6'> * 请求api指引方法</d></pre> <pre><d class='s6'> /</d></pre> <pre><d class='s6'> // public function _req_api($url,$param)</d></pre> <pre><d class='s6'> // {</d></pre> <pre><d class='s6'> // // 请求信息</d></pre> <pre><d class='s6'> // if (is_array($param) || is_object($param)) {</d></pre> <pre><d class='s6'> // $param_en = http_build_query($param);</d></pre> <pre><d class='s6'> // } else {</d></pre> <pre><d class='s6'> // $param_en = $param;</d></pre> <pre><d class='s6'> // } </d></pre> <pre><d class='s6'> </d></pre> <pre><d class='s6'> // if ($this->curl_model->http_post($this->api_url.$url,$param)) {</d></pre> <pre><d class='s6'> // $json = $this->curl_model->tmp_info;</d></pre> <pre><d class='s6'> // $data = json_decode($json,TRUE);</d></pre> <pre><d class='s6'> </d></pre> <pre><d class='s6'> // /记录日志/</d></pre> <pre><d class='s6'> // $param_str = urldecode($param_en);</d></pre> <pre><d class='s6'> // $api_info = "httpCode: {$this->curl_model->http_code} \n url: {$this->api_url}{$url} \n param: {$param_str} \n result: \n {$json} ";</d></pre> <pre><d class='s6'> // \SeasLog::info($api_info,array(),'api');</d></pre> <pre><d class='s6'> </d></pre> <pre><d class='s6'> // /定义返回数据/</d></pre> <pre><d class='s6'> // $data['json'] = $json;</d></pre> <pre><d class='s6'></d></pre> <pre><d class='s6'> // // 客户端登录数据还在 - 向后台发送同步登陆session</d></pre> <pre><d class='s6'> // if (!empty($data['errno']) && $data['errno'] == -1100 && !empty($_SESSION["web"]["user_info"])) {</d></pre> <pre><d class='s6'> // $this->_synchrodata();</d></pre> <pre><d class='s6'> // return $this->_req_api($url,$param);</d></pre> <pre><d class='s6'> // }</d></pre> <pre><d class='s6'></d></pre> <pre><d class='s6'> // if (!empty($data['json'])) {</d></pre> <pre><d class='s6'> // return $data;</d></pre> <pre><d class='s6'> // }</d></pre> <pre><d class='s6'> // throw new \Exception("no json data", -2000);</d></pre> <pre><d class='s6'> // } else {</d></pre> <pre><d class='s6'> // throw new \Exception("curl error", -2001);</d></pre> <pre><d class='s6'> // }</d></pre> <pre><d class='s6'> // }</d></pre> <pre><d class='s6'></d></pre> <pre><d class='s10'>is_mobile_request 耗时?优化:根据session,判断是否是mobile。不必每次都计算。</d></pre> <pre><d class='s6'></d></pre> <t id='85b4a38b-b12e-4a47-b7c5-84f6366ff3d9'> <pre class='tnd_head'>lv1=mynote lv2= type=todo</pre> <pre><d class='s6'>session中存储pv信息,避免数据库操作。</d></pre> <pre><d class='s18'>public function </d><d class='s10'>Addpv(</d><d class='s19'>$arr</d><d class='s10'>)</d></pre> <pre><d class='s10'>{</d></pre> <pre><d class='s10'> </d><d class='s19'>$rs </d><d class='s10'>= \Yii::</d><d class='s21'>$app</d><d class='s10'>-></d><d class='s18'>db</d><d class='s10'>->createCommand()->Insert(</d><d class='s20'>'artpv'</d><d class='s10'>,</d><d class='s19'>$arr</d><d class='s10'>)->execute();</d></pre> <pre><d class='s6'>这个会导致复杂的运算??耗时??</d></pre> <pre><d class='s6'></d></pre> <pre><d class='s6'>SELECT</d></pre> <pre><d class='s6'> kcu.constraint_name,</d></pre> <pre><d class='s6'> kcu.column_name,</d></pre> <pre><d class='s6'> kcu.referenced_table_name,</d></pre> <pre><d class='s6'> kcu.referenced_column_name</d></pre> <pre><d class='s6'>FROM information_schema.referential_constraints AS rc</d></pre> <pre><d class='s6'>JOIN information_schema.key_column_usage AS kcu ON</d></pre> <pre><d class='s6'> (</d></pre> <pre><d class='s6'> kcu.constraint_catalog = rc.constraint_catalog OR</d></pre> <pre><d class='s6'> (kcu.constraint_catalog IS NULL AND rc.constraint_catalog IS NULL)</d></pre> <pre><d class='s6'> ) AND</d></pre> <pre><d class='s6'> kcu.constraint_schema = rc.constraint_schema AND</d></pre> <pre><d class='s6'> kcu.constraint_name = rc.constraint_name</d></pre> <pre><d class='s6'>WHERE rc.constraint_schema = database() AND kcu.table_schema = database()</d></pre> <pre><d class='s6'>AND rc.table_name = 'artpv' AND kcu.table_name = 'artpv'</d></pre> </t> <pre><d class='s6'></d></pre> <pre><d class='s10'>SessionTools controller不要直接使用</d></pre> <pre><d class='s10'></d></pre> <pre><d class='s10'></d></pre> <pre><d class='s10'>get_message_bool </d><d class='s6'>todo</d><d class='s3'></d></pre> <pre><d class='s6'></d></pre> <pre><d class='s6'></d></pre> <pre><d class='s20'>'user_info' </d><d class='s10'>=> </d><d class='s19'>$this</d><d class='s10'>-></d><d class='s21'>user_info</d><d class='s10'>,</d></pre> <pre><d class='s10'></d></pre> <pre><d class='s6'><?= $user_info["username"]; ?></d></pre> <pre><d class='s18'><?= </d><d class='s19'>$user_info</d><d class='s10'>[</d><d class='s20'>'username'</d><d class='s10'>]; </d><d class='s18'>?></d></pre> <pre><d class='s6'></d></pre> <t id='45d14f40-770c-4489-8865-9001279d20f6'> <pre class='tnd_head'>lv1=mynote lv2= type=todo</pre> <pre><d class='s8'>评论,username不要记死了</d><d class='s16'></d></pre> <pre><d class='s16'><img src='..\pic\056364af967b1e93a00378582903a9de.jpg' /></d><d class='s0'></d></pre> </t> <t id='b2bfda1b-c524-4338-8efc-0d214b2c89a4'> <pre class='tnd_head'>lv1=mynote lv2= type=todo</pre> <pre><d class='s0'>是否登录不应该以有无session为标记</d></pre> </t> <pre><d class='s6'></d></pre> <pre><d class='s20'>user_id 未登录下,不再设置为ip</d></pre> <pre><d class='s20'></d></pre> <pre><d class='s6'>'user_info' => $this->user_info,</d></pre> <pre><d class='s6'></d></pre> <pre><d class='s19'>$_SESSION</d><d class='s10'>[</d><d class='s20'>'web'</d><d class='s10'>][</d><d class='s20'>'user_info'</d><d class='s10'>][</d><d class='s20'>'username'</d><d class='s10'>]; -> </d><d class='s19'>$this</d><d class='s10'>-></d><d class='s21'>user_info</d><d class='s10'>[</d><d class='s20'>'username'</d><d class='s10'>]</d></pre> <pre><d class='s6'></d></pre> <pre><d class='s6'></d></pre> <t id='60deb331-b56c-418a-90a5-6b35883fb7ff'> <pre class='tnd_head'>lv1=mynote lv2= type=todo</pre> <pre><d class='s10'>actionLunbotuadd 还有用没?</d></pre> </t> <pre><d class='s3'></d></pre> <t id='1c3fad9a-cee4-44b1-a33a-6103cff2b432'> <pre class='tnd_head'>lv1=mynote lv2= type=todo</pre> <pre><d class='s6'>js不用uid,如何判断是否登录?</d><d class='s0'></d></pre> </t> <t id='f34c50ff-74a3-469f-97ef-26c1e789a9f9'> <pre class='tnd_head'>lv1=mynote lv2= type=todo</pre> <pre><d class='s0'>前后分离的头像update有问题</d></pre> </t> <t id='b4174e7e-c8e7-45f7-aa68-2d5cc403f854'> <pre class='tnd_head'>lv1=mynote lv2= type=todo</pre> <pre><d class='s0'>user、book controller取消了模板配置</d></pre> <pre><d class='s16'></d></pre> <pre><d class='s10'>getArticleNum 需要status=1判断</d><d class='s3'></d></pre> <pre><d class='s16'></d></pre> <pre><d class='s23'>编辑时不应该调用 </d><d class='s10'>_db_for_file</d></pre> <pre><d class='s16'></d></pre> </t> <pre><d class='s11'></d></pre> <pre><d class='s6'>验证码session</d></pre> <pre><d class='s6'></d></pre> <pre><d class='s19'>$uid </d><d class='s10'>= \app\lib\SessionTools::getUid();</d></pre> <pre><d class='s6'></d></pre> <pre><d class='s19'>$user_id </d><d class='s10'>= SessionTools::getUid();</d></pre> <pre><d class='s6'></d></pre> <pre><d class='s19'>$ctx </d><d class='s10'>= </d><d class='s19'>$this</d><d class='s10'>-></d><d class='s21'>context</d><d class='s10'>;</d></pre> <pre><d class='s6'></d></pre> <pre><d class='s19'>$_SESSION</d><d class='s10'>[</d><d class='s20'>'web'</d><d class='s10'>][</d><d class='s20'>'user_id'</d><d class='s10'>]</d></pre> <pre><d class='s10'>-></d></pre> <pre><d class='s19'>$ctx</d><d class='s10'>-></d><d class='s21'>user_id</d></pre> <pre><d class='s21'>SessionTools::getUid()</d></pre> <pre><d class='s10'></d></pre> <pre><d class='s19'>$_SESSION</d><d class='s10'>[</d><d class='s20'>'web'</d><d class='s10'>][</d><d class='s20'>'user_info'</d><d class='s10'>][</d><d class='s20'>'username'</d><d class='s10'>]</d></pre> <pre><d class='s10'>-></d></pre> <pre><d class='s19'>$ctx</d><d class='s10'>-></d><d class='s21'>user_info</d><d class='s10'>[</d><d class='s20'>"username"</d><d class='s10'>]</d></pre> <pre><d class='s10'></d></pre> <pre><d class='s19'>$session </d><d class='s10'>= SessionTools::getSession();</d></pre> <pre><d class='s6'></d></pre> <pre><d class='s19'>$web </d><d class='s10'>= &SessionTools::get(</d><d class='s20'>'web'</d><d class='s10'>);</d></pre> <pre><d class='s18'>unset</d><d class='s10'>(</d><d class='s19'>$web</d><d class='s10'>[</d><d class='s20'>'check_code_time'</d><d class='s10'>]);</d></pre> <pre><d class='s6'></d></pre> <pre><d class='s6'>这样可以:</d></pre> <pre><d class='s19'>$aaa </d><d class='s10'>= </d><d class='s18'>null</d><d class='s10'>;</d></pre> <pre><d class='s18'>unset</d><d class='s10'>(</d><d class='s19'>$aaa</d><d class='s10'>[</d><d class='s20'>"aaab"</d><d class='s10'>]);</d></pre> <pre><d class='s18'>echo </d><d class='s20'>"ok"</d><d class='s10'>;</d></pre> <pre><d class='s6'></d></pre> <t id='81272045-93b4-4e4e-9f37-c28d4c6d8ccf'> <pre class='tnd_head'>lv1=mynote lv2= type=todo</pre> <pre><d class='s6'>信息放session,如果每次不从数据库中取,可能不是最新的。</d></pre> <pre><d class='s6'></d></pre> <pre><d class='s6'>getuserinfo 如何调用??</d></pre> </t> <pre><d class='s0'></d></pre> <h1 id='ol_8'>gogs todo</h1> <pre><d class='s6'></d></pre> <pre><d class='s6'>message_text_relation_aid</d></pre> <pre><d class='s6'></d></pre> <pre><d class='s6'><a href='https://github.com/gogs/go-gogs-client/wiki'>https://github.com/gogs/go-gogs-client/wiki</a></d></pre> <pre><d class='s6'><a href='https://github.com/gogs/go-gogs-client/wiki/Administration-Users'>https://github.com/gogs/go-gogs-client/wiki/Administration-Users</a></d></pre> <pre><d class='s6'><a href='https://github.com/gogs/go-gogs-client/wiki/Administration-Repositories'>https://github.com/gogs/go-gogs-client/wiki/Administration-Repositories</a></d></pre> <pre><d class='s6'></d></pre> <pre><d class='s6'>新的操作令牌生成成功!您必须立即复制到一个安全的地方,因为该令牌只会显示一次!</d></pre> <pre><d class='s6'></d></pre> <pre><d class='s20'>collaborators</d></pre> <pre><d class='s0'></d></pre> <t id='700c74ad-e8a0-41f9-99df-e2496efb82c6'> <pre class='tnd_head'>lv1= lv2= type=</pre> <h1 id='ol_9'>短信</h1> <pre><d class='s1'>AccessKey详情</d></pre> <pre><d class='s1'>AccessKeyID:LTAImnfwWptNEeqz AccessKeySecret:u2ClVsV29RQl4GYFOQvduU0ujV6riY </d></pre> </t> <pre><d class='s0'></d></pre> <h1 id='ol_10'>前后分离</h1> <pre><d class='s23'>前端的controller,不应该返回json,api访问直接调用api的controller: -- 但这样会有跨域问题。可以考虑怎样简化代码</d><d class='s2'></d></pre> <pre><d class='s2'>public function </d><d class='s3'>actionTelregister()</d></pre> <pre><d class='s3'>{</d></pre> <pre><d class='s3'> </d><d class='s11'>$tel </d><d class='s3'>= </d><d class='s11'>$this</d><d class='s3'>-></d><d class='s4'>req</d><d class='s3'>->post(</d><d class='s15'>'tel'</d><d class='s3'>, </d><d class='s2'>FALSE</d><d class='s3'>);</d></pre> <pre><d class='s3'> </d><d class='s11'>$code </d><d class='s3'>= </d><d class='s11'>$this</d><d class='s3'>-></d><d class='s4'>req</d><d class='s3'>->post(</d><d class='s15'>'code'</d><d class='s3'>, </d><d class='s2'>FALSE</d><d class='s3'>);</d></pre> <pre><d class='s3'> </d><d class='s11'>$password </d><d class='s3'>= </d><d class='s11'>$this</d><d class='s3'>-></d><d class='s4'>req</d><d class='s3'>->post(</d><d class='s15'>'password'</d><d class='s3'>, </d><d class='s2'>FALSE</d><d class='s3'>);</d></pre> <pre><d class='s3'> </d></pre> <pre><d class='s3'> </d><d class='s11'>$user_logic </d><d class='s3'>= </d><d class='s2'>new </d><d class='s3'>UserLogic();</d></pre> <pre><d class='s3'> </d><d class='s11'>$result </d><d class='s3'>= </d><d class='s11'>$user_logic</d><d class='s3'>->user_telregister(</d><d class='s11'>$tel</d><d class='s3'>,</d><d class='s11'>$code</d><d class='s3'>,</d><d class='s11'>$password</d><d class='s3'>);</d></pre> <pre><d class='s3'> </d></pre> <pre><d class='s3'> </d><d class='s2'>return </d><d class='s11'>$this</d><d class='s3'>->handle_result(</d><d class='s11'>$result</d><d class='s3'>);</d></pre> <pre><d class='s3'>}</d></pre> <pre><d class='s0'></d></pre> <h1 id='ol_11'>规范 review</h1> <pre><d class='s6'>新增代码要review 再合并到master</d></pre> <pre><d class='s8'></d></pre> <h1 id='ol_12'>mynote codetracker/ct error</h1> <pre><d class='s0'><a href='..\pub/php_ct.html#39102fb3-59da-4df7-97b0-bb5c768d8978'>php codetracker ct </a></d></pre> <pre><d class='s1'></d></pre> <pre><d class='s1'>views/user/login.php</d></pre> <pre><d class='s2'>function </d><d class='s3'>check() {</d></pre> <pre><d class='s1'></d></pre> <pre><d class='s1'>E:\uninote\mynote\basic\views</d></pre> <pre><d class='s1'>common.php</d></pre> <pre><d class='s1'>E:\uninote\mynote\basic\web\tests\log_storage.php</d></pre> <pre><d class='s1'>E:\uninote\mynote\basic\models\page.php</d></pre> <pre><d class='s1'></d></pre> <t id='6431ec74-87d0-4be6-840d-1bc60bf848ec'> <pre class='tnd_head'>lv1= lv2= type=</pre> <h1 id='ol_13'>实习 todo</h1> <pre><d class='s8'>rtf文档整理;php等文档整理</d></pre> <pre><d class='s8'>pdf-》html 整理</d></pre> </t> <pre><d class='s0'></d></pre> <h1 id='ol_14'>mynote todo tnds</h1> <t id='7a2805a0-b55d-4965-a466-58cd59f3249e'> <pre class='tnd_head'>lv1=mynote lv2= type=todo</pre> <pre><d class='s24'>// 获取当前系统时间,返回float格式,单位:秒</d><d class='s5'></d></pre> <pre><d class='s2'>function </d><d class='s3'>get_time() {</d></pre> <pre><d class='s25'> date_default_timezone_set('Asia/Shanghai');</d><d class='s3'></d></pre> <pre><d class='s3'> </d><d class='s2'>list</d><d class='s3'>(</d><d class='s11'>$usec</d><d class='s3'>, </d><d class='s11'>$sec</d><d class='s3'>) = explode(</d><d class='s15'>" "</d><d class='s3'>, microtime());</d></pre> <pre><d class='s3'> </d><d class='s2'>return </d><d class='s3'>((float)</d><d class='s11'>$usec </d><d class='s3'>+ (float)</d><d class='s11'>$sec</d><d class='s3'>);</d></pre> <pre><d class='s3'>}</d></pre> <pre><d class='s0'></d></pre> </t> <t id='6ac9d828-5977-4a94-839d-0016a2d61230'> <pre class='tnd_head'>lv1=mynote lv2= type=todo</pre> <pre><d class='s8'>自动创建git仓库、管理ssh key</d></pre> <pre><d class='s8'></d></pre> <pre><d class='s17'>SHA-1: 3ba286f4ff9561807b8ec143465470f00de5be57</d></pre> <pre><d class='s17'> </d><d class='s26'>【更新】</d><d class='s27'>- html</d><d class='s26'>缓存清理</d></pre> <pre><d class='s8'></d></pre> <pre><d class='s8'>这种容易解析不到json</d></pre> <pre><d class='s8'>[master 0743903] update</d></pre> <pre><d class='s8'> Date: Sat Aug 11 15:57:14 2018 +0800</d></pre> <pre><d class='s8'> 1 file changed, 1 insertion(+), 1 deletion(-)</d></pre> <pre><d class='s8'>Deleted branch update_1941333651 (was 0743903).</d></pre> <pre><d class='s8'>{"status":true}</d></pre> <pre><d class='s8'></d></pre> </t> <t id='8eaa33a5-72c1-4288-8f2e-fb93ed9c1637'> <pre class='tnd_head'>lv1=mynote lv2= type=todo</pre> <pre><d class='s8'>异常处理</d></pre> <pre><d class='s18'>public function </d><d class='s10'>runWithParams(</d><d class='s19'>$params</d><d class='s10'>)</d></pre> <pre><d class='s10'></d></pre> <pre><d class='s10'>这里如果已经有输出,header 500 还有作用?</d></pre> <pre><d class='s18'>public function </d><d class='s10'>render_error(</d><d class='s19'>$code</d><d class='s10'>)</d></pre> <pre><d class='s10'>{</d></pre> <pre><d class='s10'> CT(</d><d class='s20'>"app/controllers/api/common/BaseController.render_error(code){}"</d><d class='s10'>);</d></pre> <pre><d class='s10'> </d><d class='s18'>global </d><d class='s19'>$request_num</d><d class='s10'>;</d></pre> <pre><d class='s10'> </d><d class='s19'>$response </d><d class='s10'>= /Yii::</d><d class='s21'>$app</d><d class='s10'>->getResponse();</d></pre> <pre><d class='s10'> </d><d class='s19'>$response</d><d class='s10'>-></d><d class='s21'>format </d><d class='s10'>= </d><d class='s19'>$response</d><d class='s10'>::</d><d class='s21'>FORMAT_RAW</d><d class='s10'>;</d></pre> <pre><d class='s10'> </d><d class='s19'>$response</d><d class='s10'>->getHeaders()->set(</d><d class='s20'>'Status'</d><d class='s10'>, </d><d class='s28'>500</d><d class='s10'>);</d></pre> <pre><d class='s10'> </d><d class='s18'>return </d><d class='s20'>"error occurs : </d><d class='s10'>{</d><d class='s19'>$request_num</d><d class='s10'>} </d><d class='s18'>/n</d><d class='s20'> code : </d><d class='s10'>{</d><d class='s19'>$code</d><d class='s10'>}</d><d class='s20'>"</d><d class='s10'>;</d></pre> <pre><d class='s10'>}</d></pre> <pre><d class='s10'></d></pre> <pre><d class='s10'>一般的错误,不要报404</d></pre> </t> <t id='cb5a5e9c-d97c-495a-9bd9-c0f52f0e9485'> <pre class='tnd_head'>lv1=mynote lv2= type=todo</pre> <pre><d class='s8'>环境变量控制config</d></pre> </t> <pre><d class='s7'></d></pre> <pre><d class='s0'>check <a href='..\php/php.html#2dcf0f72-3e47-4e99-85dc-d97003b8c8e4'>session_start(); </a></d></pre> <pre><d class='s1'></d></pre> <pre><d class='s1'>这种不应该作为member:</d></pre> <pre><d class='s2'>public </d><d class='s11'>$curl_model </d><d class='s3'>= </d><d class='s2'>NULL</d><d class='s3'>;</d><d class='s22'>// curl 模块</d><d class='s1'></d></pre> <pre><d class='s0'></d></pre> <t id='de558c83-5c9a-4fdf-8fe4-190bccacbc90'> <pre class='tnd_head'>lv1=mynote lv2= type=todo</pre> <pre><d class='s8'>2>&1 可以放到 $this->_shell_ex($cmds);里面</d></pre> <pre><d class='s8'>免得每个都去写</d></pre> </t> <t id='7166ab04-c276-4934-a082-2df002435dfa'> <pre class='tnd_head'>lv1=mynote lv2= type=todo</pre> <pre><d class='s8'>actionResetpwd_tel actionResetpwd_email 提起公共代码</d></pre> </t> <pre><d class='s0'></d></pre> <t id='2f566d2a-9e33-4627-9ba2-80bee6432ac2'> <pre class='tnd_head'>lv1= lv2= type=todo</pre> <h1 id='ol_15'>markdown 转纯文本有问题</h1> <pre><d class='s2'>public function </d><d class='s3'>get_text(</d><d class='s11'>$html</d><d class='s3'>,</d><d class='s11'>$ext</d><d class='s3'>=</d><d class='s15'>'md'</d><d class='s3'>)</d></pre> <pre><d class='s3'>{</d></pre> <pre><d class='s3'> </d><d class='s2'>if </d><d class='s3'>(</d><d class='s11'>$ext </d><d class='s3'>== </d><d class='s15'>'md'</d><d class='s3'>) {</d></pre> <pre><d class='s3'> </d><d class='s11'>$parser </d><d class='s3'>= </d><d class='s2'>new </d><d class='s3'>\HyperDown\Parser;</d></pre> <pre><d class='s3'> </d><d class='s11'>$html </d><d class='s3'>= </d><d class='s11'>$parser</d><d class='s3'>->makeHtml(</d><d class='s11'>$html</d><d class='s3'>);</d></pre> <pre><d class='s3'> </d><d class='s11'>$html </d><d class='s3'>= </d><d class='s15'>"<html><body>" </d><d class='s3'>. </d><d class='s11'>$html </d><d class='s3'>. </d><d class='s15'>"</body></html>"</d><d class='s3'>;</d></pre> <pre><d class='s3'> </d><d class='s11'>$doc </d><d class='s3'>= \phpQuery::newDocument(</d><d class='s11'>$html</d><d class='s3'>);</d></pre> <pre><d class='s3'> </d><d class='s2'>return </d><d class='s11'>$doc</d><d class='s3'>->text();</d></pre> <pre><d class='s3'> } </d><d class='s2'>else </d><d class='s3'>{</d></pre> <pre><d class='s3'> </d><d class='s11'>$html </d><d class='s3'>= </d><d class='s11'>$this</d><d class='s3'>->CloseTags(</d><d class='s11'>$html</d><d class='s3'>);</d></pre> <pre><d class='s3'> </d><d class='s11'>$doc </d><d class='s3'>= \phpQuery::newDocument(</d><d class='s11'>$html</d><d class='s3'>);</d></pre> <pre><d class='s3'> </d><d class='s11'>$doc</d><d class='s3'>[</d><d class='s15'>"#outline"</d><d class='s3'>]->empty();</d></pre> <pre><d class='s3'> </d><d class='s11'>$doc</d><d class='s3'>[</d><d class='s15'>"style"</d><d class='s3'>]->empty();</d></pre> <pre><d class='s3'> </d><d class='s11'>$doc</d><d class='s3'>[</d><d class='s15'>"script"</d><d class='s3'>]->empty();</d></pre> <pre><d class='s3'> </d><d class='s2'>return </d><d class='s11'>$doc</d><d class='s3'>[</d><d class='s15'>"body"</d><d class='s3'>]->text();</d></pre> <pre><d class='s3'> }</d></pre> <pre><d class='s3'>}</d></pre> </t> <pre><d class='s0'></d></pre> <pre><d class='s8'></d></pre> <t id='4ac71f77-b232-4847-b4b3-a878fc195191'> <pre class='tnd_head'>lv1= lv2= type=</pre> <h1 id='ol_16'>微信公众号 掘金等一键发布 selenium</h1> <pre><d class='s1'>selenium等待用户完成某个动作。</d></pre> <pre><d class='s1'>获取数据post</d></pre> <pre><d class='s1'>js脚本?</d></pre> <pre><d class='s1'></d></pre> <pre><d class='s1'>E:\projects\tweets</d></pre> <pre><d class='s1'>E:\projects\tweets\README.md</d></pre> <pre><d class='s8'></d></pre> <pre><d class='s8'>pip3 install selenium</d></pre> <pre><d class='s8'>pip3 install yaml -> PyYAML</d></pre> <pre><d class='s8'>pip3 install requests</d></pre> <pre><d class='s8'></d></pre> <pre><d class='s8'>ERROR:root:'gbk' codec can't decode byte 0x80 in position 395: illegal multibyte sequence</d></pre> <pre><d class='s8'>Traceback (most recent call last):</d></pre> <pre><d class='s8'> File "E:\projects\tweets\workspace\baseMethod.py", line 122, in yaml_read</d></pre> <pre><d class='s8'> return yaml.load(f, yaml.FullLoader)["browser"]</d></pre> <pre><d class='s8'></d></pre> <pre><d class='s8'>pyhon-----安装yaml踩过的坑以及正解</d></pre> <pre><d class='s8'><a href='https://www.codetd.com/article/1883431'>https://www.codetd.com/article/1883431</a></d></pre> <pre><d class='s8'><a href='https://stackoverflow.com/questions/14261614/how-do-i-install-the-yaml-package-for-python'>https://stackoverflow.com/questions/14261614/how-do-i-install-the-yaml-package-for-python</a></d></pre> <pre><d class='s8'><a href='https://stackoverflow.com/questions/14261614/how-do-i-install-the-yaml-package-for-python/23613658'>https://stackoverflow.com/questions/14261614/how-do-i-install-the-yaml-package-for-python/23613658</a></d></pre> <pre><d class='s8'>There are three YAML capable packages. Syck (pip install syck) which implements the YAML 1.0 specification from 2002; PyYAML (pip install pyyaml) which follows the YAML 1.1 specification from 2004; and ruamel.yaml which follows the latest (YAML 1.2, from 2009) specification.</d></pre> <pre><d class='s8'></d></pre> <pre><d class='s8'></d></pre> <pre><d class='s8'><a href='https://github.com/yaml/pyyaml'>https://github.com/yaml/pyyaml</a></d></pre> <pre><d class='s8'></d></pre> <pre><d class='s8'><a href='https://w3c.github.io/webdriver'>https://w3c.github.io/webdriver</a></d></pre> <pre><d class='s8'></d></pre> <pre><d class='s8'>"C:\Users\Administrator\AppData\Local\Google\Chrome\Application\chrome.exe" --remote-debugging-port=9222</d></pre> <pre><d class='s29'></d></pre> <pre><d class='s8'>自动化测试-20.selenium常用JS代码执行</d></pre> <pre><d class='s8'><a href='https://www.cnblogs.com/cmnz/p/9099473.html'>https://www.cnblogs.com/cmnz/p/9099473.html</a></d></pre> <pre><d class='s1'></d></pre> <pre><d class='s1'>单独的管理后台,用mynote的账号密码登录</d><d class='s29'></d></pre> <pre><d class='s1'>同步更新:uninote编辑之后,自动同步更新到其他平台。</d></pre> <pre><d class='s1'> 能够区分出是编辑还是是新增</d></pre> <pre><d class='s1'> 管理同步到哪些平台</d></pre> <pre><d class='s1'></d></pre> <pre><d class='s1'>评论收集、统一的评论管理</d></pre> <pre><d class='s1'>统计阅读量、评论、点赞量,每日数据统计</d></pre> <pre><d class='s1'></d></pre> <pre><d class='s1'>消息统一管理</d></pre> <pre><d class='s8'></d></pre> <pre><d class='s8'>uninote 发文章之后,默认同步到其他平台。</d></pre> <pre><d class='s6'>aidmynotejuejinsegmentdefaultviewcommentlikepublish?viewcommentlikepublish?viewcommentlikepublish?1132yesnoyes</d><d class='s1'></d></pre> <pre><d class='s1'><img src='..\pic\a82539c82ab775397a284264344bb6dc.jpg' /></d><d class='s1'></d></pre> <pre><d class='s1'></d></pre> </t> <pre><d class='s0'></d></pre> <t id='a2c8f450-51b0-4b30-abb0-19c4fe29d9b5'> <pre class='tnd_head'>lv1= lv2= type=</pre> <h1 id='ol_17'>提醒工具 todo list</h1> <pre><d class='s0'></d></pre> <pre><d class='s0'>告诉xx做一件事,1h 检查,我记录在电脑上</d></pre> <pre><d class='s0'>1h后,电脑上提醒我,如果我没有关掉,消息推送;还是不行,短信</d></pre> <pre><d class='s0'>(换一句话说:桌面 创建时;也可以自定义延迟时间,过了此设定,则手机震动提醒。再超过一定的阈值发送短信)</d></pre> <pre><d class='s0'></d></pre> <pre><d class='s0'>手机上可以修改。</d></pre> <pre><d class='s0'></d></pre> <pre><d class='s0'>再次提醒 10 20 分钟 可以自定义;</d></pre> <pre><d class='s0'></d></pre> <pre><d class='s1'>方便创建</d><d class='s6'></d></pre> <pre><d class='s0'>服务器同步,多端可以同时修改。</d></pre> <pre><d class='s0'>支持桌面(桌面版支持热键)、手机端(小程序+hbuilder)</d></pre> <pre><d class='s0'></d></pre> </t> <pre><d class='s0'></d></pre> <pre><d class='s8'></d></pre> <t id='717dcc61-7c1b-4816-990a-f26691ec4b78'> <pre class='tnd_head'>lv1= lv2= type=</pre> <h1 id='ol_18'>【干货】Chrome插件(扩展)开发全攻略 大纲生成器 uoutline extension</h1> <pre><d class='s8'><a href='https://www.cnblogs.com/liuxianan/p/chrome-plugin-develop.html'>https://www.cnblogs.com/liuxianan/p/chrome-plugin-develop.html</a></d></pre> <pre><d class='s8'><img src='..\pic\82be50309e9569453034fc43c5d8f35b.jpg' /></d><d class='s0'></d></pre> <pre><d class='s0'></d></pre> <pre><d class='s0'>〖E:\projects\directory_generator_chrome_plugin〗</d></pre> <pre><d class='s0'></d></pre> <pre><d class='s0'>popup 点击后自动关闭</d></pre> <pre><d class='s0'></d></pre> <pre><d class='s0'>快捷键</d></pre> <pre><d class='s0'>打包</d></pre> <pre><d class='s0'></d></pre> <pre><d class='s0'><a href='mynote_todo_tools.html#4076da17-ab06-4eb1-b0e6-fef47ebc7a65'>收藏夹 浏览器辅助工具 </a></d></pre> <pre><d class='s0'>page rank</d></pre> <pre><d class='s0'><a href='..\css/css.html#6088c791-6bce-484d-bd20-031b52849f41'>style dump debug </a></d></pre> <pre><d class='s0'></d></pre> <pre><d class='s0'><a href='https://element.eleme.cn'>https://element.eleme.cn</a> 这个有问题,不能定位</d></pre> </t> <pre><d class='s8'></d></pre> <pre><d class='s0'></d></pre> <pre><d class='s0'>-end</d></pre> <pre><d class='s0'></d></pre> </body></html>

mynote_tnds

mynote_todo0304

点赞(0) 阅读(52) 举报
目录
标题