可能重复:
PHP中的HTML Scraping
我想知道是否有任何方法可以从网页获取一个特定的文本字符串,每次都会使用PHP进行更新.我搜索"遍布互联网"并没有找到任何结果.刚刚看到preg_match可以做到,但我不明白如何使用它.
想象一个网页包含这个:
<div name="changeable_text">**GET THIS TEXT**</div>
Run Code Online (Sandbox Code Playgroud)
在用过file_get_contents将页面放入变量后,如何使用PHP ?
提前致谢 :)
我正在开发一个网站工具,我想出了一个奇怪的问题,或者更好,一个奇怪的情况.
我正在使用下面的代码从TeamSpeak服务器检索数据.我使用此信息在用户上构建配置文件.
$ts3 = TeamSpeak3::factory("serverquery://dadada:dadada@dadada:1234/");
// Get the clients list
$a=$ts3->clientList();
// Get the groups list
$b=$ts3->ServerGroupList();
// Get the channels list
$c=$ts3->channelList();
Run Code Online (Sandbox Code Playgroud)
现在,奇怪的情况是这个代码块的输出:
// Get the clients list
$a=$ts3->clientList();
// Get the groups list
$b=$ts3->ServerGroupList();
// Get the channels list
$c=$ts3->channelList();
echo "<pre>";print_r($a);die();
Run Code Online (Sandbox Code Playgroud)
(注意print_r)
与此代码块的输出完全不同:
// Get the clients list
$a=$ts3->clientList();
// Get the groups list
#$b=$ts3->ServerGroupList();
// Get the channels list
#$c=$ts3->channelList();
echo "<pre>";print_r($a);die();
Run Code Online (Sandbox Code Playgroud)
我的意思是,我调用的函数clientList()(我在变量中存储的输出$a)正在改变该变量的内容.也就是说,它们将输出附加到变量上.
我从来没有专业地学过PHP,我只是试着把它...我错过了一些关于这种行为的语言吗?如果我是,我该怎么做才能阻止它?
谢谢你们.
我有这个使用webkit滚动条的css代码.
::-webkit-scrollbar {
width: 8px;
height: 8px;
}
Run Code Online (Sandbox Code Playgroud)
这将使滚动条紧靠屏幕边缘.有什么办法可以在屏幕边缘和滚动条之间留出一些空间吗?