• Welcome to Rotar E@rth!
  • Feel free to look around and comment~
  • Tin - for a better fantasy life!
  • TinTimer - for an even better fantasy life!

PMangar再启动计划 | Revival of PMangar

Blog Rotar 581 Views 0 Comment



————————–Lang Sep—————————–

PMangar was an simple php application that fetches comics from 178.com and display it to the user. In other words, its just an online comic viewer. The work are considered done in last year as the result of using it on both Kindle and my Nokia phone seems to be satisfactory. However, when I checked the application few days ago, nothing seems to be working and therefore I’m here to repair and upgrade it. The currently working version is available at http://rotar.tk/pm.

This post intend to share what I’ve learnt about php during the process and hope it may help.

1. preg_match(_all)( string $pattern , string $subject [, array &$matches [, int $flags = PREG_PATTERN_ORDER [, int $offset = 0 ]]] )

此前对这个函数并没有深入了解过,于是在提取固定位置的字符串的时候用的是先找前后固定字符然后把中间提出来然后利用固定的起始位置将所需要的文字切出来的办法,不可谓不麻烦。而看过preg_match的example之后,发现只需要在 $pattern 中把所需要的文字部分用括号括住就可以在 $matches[1] 中直接获得需要的内容。

例子如下 Example:


本网站采用BY-NC-SA协议进行授权 , 转载请注明PMangar再启动计划 | Revival of PMangar
Like (0)

表情 贴图 加粗 删除线 居中 斜体 签到


  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址