目前我的代码如下:
for ($i=0; $i<=($num_newlines - 1); $i++)
{
$tweetcpitems->post('statuses/update',
array('status' => wordFilter("The item $parts[$i] has been released on Club Penguin. View it here: http://clubpenguincheatsnow.com/tools/swfviewer/items.swf?id=$parts[$id]")));
sleep(90);
}
Run Code Online (Sandbox Code Playgroud)
我想要做的是让"i ++"部分加两个而不是一个,但我该怎么做?请帮忙!
我有一个问题,我想抓取文本并执行PHP文本,但我该怎么做?例如,我在.txt文件中有这个代码:
$tweetcpitems->post('statuses/update', array('status' => wordFilter("The item Blue has been released on Club Penguin.")));
$tweetcpitems->post('statuses/update', array('status' => wordFilter("The item Green has been released on Club Penguin.")));
Run Code Online (Sandbox Code Playgroud)
现在问题是我抓住了这个文本,我想把它作为PHP脚本执行,我该怎么做?请帮忙!
目前我有这个代码:
<?php
echo '<meta name="robots" content="noindex">';
$arr = json_decode(file_get_contents("http://media1.clubpenguin.com/play/en/web_service/game_configs/ paper_items.json"),true);
foreach($arr as $item) {
$label = $item['label'];
$cost = $item['cost'];
$id = $item['paper_item_id'];
$member = $item['is_member'];
if ($member == "1") {
$member = "Yes";
}else{
$member = "No";
}
echo "$label = $id = $member = $cost";
echo ",<br>";
}
?>
Run Code Online (Sandbox Code Playgroud)
这段代码的作用是它
在每一行之后添加一个标记.这是它发生的片段:
echo "$label = $id = $member = $cost";
echo ",<br>";
Run Code Online (Sandbox Code Playgroud)
我想要的是在线的最后一行echo ",<br>";不要运行.我该怎么做呢?请帮忙!
我想知道如何检测页面何时使用PHP更新.我在Google上研究了一些东西,但没有发现任何东西.
我想要做的是在页面更新时调用特定的函数.我将运行一个cron作业来运行代码.
我想要这样的东西:
if (page updated) {
//functions
}
else
{
//functions
}
Run Code Online (Sandbox Code Playgroud)
如果我不能做那样的事情那么我想至少知道如何检测页面何时用PHP更新.请帮忙!
我目前有一个问题.我有一个看起来像下面的代码,我想要一个运算符,检查查询的一部分是否存在于数组中.这是我的代码:
<?php
$search = 'party hat';
$query = ucwords($search);
$string = file_get_contents('http://clubpenguincheatsnow.com/tools/newitemdatabase/items.php');
$string = explode('<br>',$string);
foreach($string as $row)
{
preg_match('/^(\D+)\s=\s(\d+)\s=\s(\D+)\s=\s(\d+)/', trim($row), $matches);
if($matches[1] == "$query")
{
echo "<a href='http://clubpenguincheatsnow.com/tools/newitemdatabase/info.php?id=$matches[2]'>";
echo $matches[1];
echo "</a><br>";
}
}
?>
Run Code Online (Sandbox Code Playgroud)
我想要做的不是if($matches[1] == "$query")检查两者是否相同,我希望我的代码看看是否$query存在PART $matches[1].我怎么做呢?请帮我!