小编Tha*_*son的帖子

SimpleHTTPServer - 提供大文件

我正在python -m SimpleHTTPServer用于一个小项目.文件index.html引用了一些视频. <video><source src="big_buck_bunny_480p_stereo.ogg"></video> 此文件的大小为159 MB.当我尝试下载它时,SimpleHTTPServer会抛出一些错误消息而不是我的视频.

Marc-Laptop - - [23/Sep/2012 18:18:29] "GET /big_buck_bunny_480p_stereo.ogg HTTP
/1.1" 200 -
----------------------------------------
Exception happened during processing of request from ('192.168.4.38', 51152)
Traceback (most recent call last):
  File "C:Program Files (x86)PythonlibSocketServer.py", line 284, in _handle
_request_noblock
    self.process_request(request, client_address)
  File "C:Program Files (x86)PythonlibSocketServer.py", line 310, in process
_request
    self.finish_request(request, client_address)
  File "C:Program Files (x86)PythonlibSocketServer.py", line 323, in finish_
request
    self.RequestHandlerClass(request, client_address, self)
  File "C:Program Files (x86)PythonlibSocketServer.py", line 640, in __init_
_
    self.finish()
  File …
Run Code Online (Sandbox Code Playgroud)

python http simplehttpserver

5
推荐指数
0
解决办法
5745
查看次数

使用preg_match在字符串中查找img标记

如何在PHP中找到字符串中的HTML标记?

这是我的数据库中的记录:

$str = "This is me <img src='images/mardagz.png' width='200' /> :) when i was 4th year highschool hahah so funny...";
Run Code Online (Sandbox Code Playgroud)

我正在尝试获取<img>标签的内容.这是我正在使用的代码:

$gimg = preg_match('/<img[^>]+\>/i', $str , $matches) ? $matches[1]: '<img src="http://facebook.com/username/profile.png" width="200" />
Run Code Online (Sandbox Code Playgroud)

但是,这段代码总是给我这个错误: Notice: Undefined offset: 1 in mardagz.blog\post.php on line 19

我该怎么办?

php regex

0
推荐指数
1
解决办法
2万
查看次数

标签 统计

http ×1

php ×1

python ×1

regex ×1

simplehttpserver ×1