嗨,我在POST请求中尝试PHP Post Request,认为它可能对我有用,我的代码如下所示
$sub_req_url = "http://localhost/index1.php";
$ch = curl_init($sub_req_url);
$encoded = '';
// include GET as well as POST variables; your needs may vary.
foreach($_GET as $name => $value) {
$encoded .= urlencode($name).'='.urlencode($value).'&';
}
foreach($_POST as $name => $value) {
$encoded .= urlencode($name).'='.urlencode($value).'&';
}
// chop off last ampersand
$encoded = substr($encoded, 0, strlen($encoded)-1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $encoded);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_POST, 1);
curl_exec($ch);
curl_close($ch);
Run Code Online (Sandbox Code Playgroud)
形成index.php文件和index2.php是同一目录中的另一个文件,当我打开页面时,我的error.log文件中出现以下错误
[Sat Dec 18 15:24:53 2010] [error] [client ::1] PHP Fatal …Run Code Online (Sandbox Code Playgroud) 我正在使用MySQL数据库,并一直在使用数据库驱动的搜索.数据库引擎和Lucene搜索引擎的优缺点是什么?我想就何时何地使用它们提出建议?
我有这个我想做的事情.我有一张地图的主要图片,在该地图中有区域.这些区域上有热点,因此您可以单击它们,它将仅用区域替换整个地图.(只是一个简单的div交换).
我需要它作为一个div因为在这里div我有热点列出.
总共有4个divs我需要这样做.
如果有人能帮助我那将是非常棒的!
因此,表中列出的链接需要单独替换图像div.
<tr class="thumb"></tr>
<td>All Regions (shows main map) (link)</td>
</tr>
<tr class="thumb"></tr>
<td>Northern Region (link)</td>
</tr>
<tr class="thumb"></tr>
<td>Southern Region (link)</td>
</tr>
<tr class="thumb"></tr>
<td>Eastern Region (link)</td>
</tr>
</table>
<div>All Regions image</div>
<div>northern image</div>
<div>southern image</div>
<div>Eastern image</div>
Run Code Online (Sandbox Code Playgroud)
我不允许发布图片,因为我没有足够的分数,所以我知道图片链接不起作用.
我决定在xml文件中保存设置,因为字段只有一个值.
我的XML文件就像
<?xml version="1.0" encoding="UTF-8"?>
<setting>
<setting1>setting1 value</setting1>
<setting2>setting2 value</setting2>
<setting3>setting3 value</setting3>
....
....
....
</setting>
Run Code Online (Sandbox Code Playgroud)
谁能建议我一个简单的PHP脚本来读取,编辑,添加和删除节点和节点值?
要正常更新(布尔)值,我们会检查它是否设置为false或true,并更新它,我想知道是否有查询将切换布尔值.
如果我这样做,那么$tablemodel扩展的模型实例中的变量Zend_Db_Table_Abstract
$tablemodel->insert($data)
Run Code Online (Sandbox Code Playgroud)
插入数据.是否有任何方法或属性来获取最后一个插入ID?
问候
我知道如何从layout.phtml文件中获取控制器名称和操作名称,以便我可以制作动态css.
编辑::哦,我忘了
class Test1{
public static function test(){
for($i=0; $i<=1000; $i++)
$j += $i;
}
}
class Test2{
public function test() {
for ($i=0; $i<=1000; $i++){
$j += $i;
}
}
}
Run Code Online (Sandbox Code Playgroud)
对于这个算法
$time_start = microtime();
$test1 = new Test2();
for($i=0; $i<=100;$i++)
$test1->test();
$time_end = microtime();
$time1 = $time_end - $time_start;
$time_start = microtime();
for($i=0; $i<=100;$i++)
Test1::test();
$time_end = microtime();
$time2 = $time_end - $time_start;
$time = $time1 - $time2;
echo "Difference: $time";
Run Code Online (Sandbox Code Playgroud)
我有结果
Difference: 0.007561
Run Code Online (Sandbox Code Playgroud)
而这些天,我试图让我的方法尽可能静态.但它真的是真的,至少对于PHP来说
任何人都可以帮我搞清楚IE的css(蓝图css)
我已经做好了
<?php $headlink = $this->headLink();
$headlink->appendStylesheet($this->baseUrl('css/blueprint/screen.css') , 'screen, projection')
->appendStylesheet($this->baseUrl('css/blueprint/ie.css'), 'screen, projection', "IE")
->appendStylesheet($this->baseUrl('css/blueprint/print.css'));
echo $headlink;
?>
Run Code Online (Sandbox Code Playgroud)
而且这段代码也不起作用
<?php $headlink = $this->headLink();
$headlink->appendStylesheet($this->baseUrl('css/blueprint/screen.css') , 'screen, projection')
->appendStylesheet($this->baseUrl('css/blueprint/ie.css'), 'screen, projection', true)
->appendStylesheet($this->baseUrl('css/blueprint/print.css'));
echo $headlink;
?>
Run Code Online (Sandbox Code Playgroud)
更新::
它看起来很像
<!--[if lt IE 8]><link rel="stylesheet" href="css/blueprint/ie.css" type="text/css" media="screen, projection"><![endif]-->
Run Code Online (Sandbox Code Playgroud)