我正在做一些关于从PHP最小化html的研究.喜欢
class themeing
{
function render( $file, $folder )
{
if ( COMPRESS ) {
// this is the problem
ob_start('compressor');
}
$get = VIEWS . $folder . '/' . $file . '.phtml';
if ( COMPRESS ) {
ob_end_flush();
}
return $get;
}
function compressor($buffer)
{
$search = array(
'/<!--(.|\s)*?-->/',
'/\>[^\S ]+/s',
'/[^\S ]+\</s',
'/(\s)+/s'
);
$replace = array(
'',
'>',
'<',
'\\1'
);
$buffer = preg_replace($search, $replace, $buffer);
return $buffer;
}
}
Run Code Online (Sandbox Code Playgroud)
问题是如何调用这个ob_start(函数)?我们可以像ob_start($ this-> compresssor())那样做吗?(好吧,我知道它失败了)在课堂上?任何人 ??
谢谢你的关注.
亚当拉马丹
你好我在php中创建一个解析器,你可以在下面看到它转换
*this* _this_要像这样 这样
$db['profile']['information'] = str_replace( "\n" , "<br/>" , $db['profile']['information']);
$db['profile']['information'] = preg_replace('/\*([^\*]+)\*/', '<strong>\1</strong>', $db['profile']['information']);
$db['profile']['information'] = preg_replace('/_([^[_]+)_/', '<em>\1</em>', $db['profile']['information']);
$db['profile']['information'] = preg_replace('/\[img\]((?:[^\[]+|\[(?!img\]))*)\[img\]/', '<img src="\1" />', $db['profile']['information']);
Run Code Online (Sandbox Code Playgroud)
问题出在img上.
例如,我有一个网址,[img]123_460217980773_23232_11_*23123*_n.jpg[img]你知道它会解析什么.它的史诗.任何人都可以帮我解决吗?
谢谢你的时间
亚当拉马丹
让我们说我们想从php制作一个python配置阅读器.
config.php文件
$arr = array(
'a config',
'b config',
'c config => 'with values'
)
$arr2 = array(
'a config',
'b config',
'c config => 'with values'
)
Run Code Online (Sandbox Code Playgroud)
readconfig.py
f = open('config.php', 'r')
// somehow get the array then turns it into pythons arr1 and arr2
print arr1
# arr1 = {'a config', 'b config', 'c config': 'with values'}
print arr2
# arr2 = {'a config', 'b config', 'c config': 'with values'}
Run Code Online (Sandbox Code Playgroud)
这可能在python中?
我有一些数组:
array
0 => string 'Apple'
1 => string 'banana'
2 => string 'Nanas'
3 => string 'Grape'
Run Code Online (Sandbox Code Playgroud)
什么是最好的展示方式
1. Apple 2. banana 3. Nanas 4. Grape
有任何想法吗?
数据库的排序规则是什么用途?对于HTML UTF-8,我知道一点,比如显示其他语言类型.但是对于数据库呢?我正在使用latin-1(默认),我的朋友告诉我使用UTF代替.当我问为什么时,他们不知道并说其他人使用它.所以我在质疑校对真正做了什么?它会影响速度或类似的东西吗?
"Lorem Ipsum只是印刷和排版行业的虚拟文本."
从
"Lorem Ipsum只是印刷和排版行业的虚拟文本.自16世纪以来,Lorem Ipsum一直是业界标准的虚拟文本,当时一个未知的打印机拿了一个类型的厨房并乱扰它制作一个类型的样本书.它幸存了下来不仅五个世纪,而且电子排版的飞跃,基本保持不变.它在20世纪60年代推出了包含Lorem Ipsum通道的Letraset表,以及最近使用包括Lorem Ipsum版本在内的桌面出版软件Aldus PageMaker. "
我们怎么能这样做?做这样的事情在php中是否有一个很好的功能?
谢谢
亚当拉马丹
你好,我需要以某种方式获得最高的区域利益和兴趣随着时间的推移
http://www.google.com/trends?q=lingerie+&ctab=0&geo=id&date=all&sort=0
或更好
http://www.google.com/insights/search/#q=lingerie&geo=ID&cmpt=q
所以我发现我们必须登录导出数据任何人都可以用我们的谷歌用户名和密码给我一个例子吗?也许使用curl导出数据?或者是其他东西
谢谢你的关注
亚当拉马丹
假设我有一个文本
<span class="hide">for real</span><h2 id='show'>Obama is rocking the house</h2>
<span class="hide">not real</span><h2 id='show'>Bill gates is buying stackoverflow</h2>
Run Code Online (Sandbox Code Playgroud)
我需要爬虫来读取
<h2 id='show'>Obama is rocking the house</h2>
<h2 id='show'>Bill gates is buying stackoverflow</h2>
Run Code Online (Sandbox Code Playgroud)
我们能做到吗?
我在这里有点困惑说谷歌读取了一个隐藏的div
但是当我用谷歌搜索一秒钟时,我发现谷歌没有读取隐藏的 div。那么哪个是对的?
http://www.seroundtable.com/archives/002971.html
我的想法是像使用 css 一样使用它。
你好我试图在两个字符串之间添加一个空格并将它们扫描成一个变量
在PHP中我们可以用+添加它们
front_name = "hello";
back_name = "world";
full_name = strcpy(m[index].p.something, front_name + " " + backname);
// should output hello world
Run Code Online (Sandbox Code Playgroud)
在c中执行此操作的等效或正确方法是什么?
我很难用我的elasticsearch安装设置JDBC river mysql连接器
首先,我遵循所有https://github.com/jprante/elasticsearch-river-jdbc howto
差异是我通过yum install elasticsearch从RPM存储库安装elasticsearch的地方,不知怎的,它在/ usr/share/elasticsearch中安装了我的elasticsearch,但配置在/ etc/elasticsearch中
问题在于我安装了jdbc插件,安装后已经检查过plugin -l,是的,有一个jdbc驱动程序,但是当我运行bin/elasticsearch
它没有显示任何有用的信息

它有效吗?我怎么能显示[DEBUG]和[INFO]?