本文整理汇总了PHP中city::setValue方法的典型用法代码示例。如果您正苦于以下问题:PHP city::setValue方法的具体用法?PHP city::setValue怎么用?PHP city::setValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类city
的用法示例。
在下文中一共展示了city::setValue方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: time
$time = time();
if (file_get_contents('transaction_lock') > $time - 30) {
die('LOCK');
}
file_put_contents('transaction_lock', time());
require_once dirname(__FILE__) . '/include/connectDB.php';
require_once dirname(__FILE__) . '/include/city.php';
require_once dirname(__FILE__) . '/include/user.php';
require_once dirname(__FILE__) . '/include/unit_functions.php';
require_once dirname(__FILE__) . '/include/twitter.php';
$transactions = mysql_query("SELECT server_id,destination,unit_id,unit_count,user_id FROM server_unit_transaction WHERE eta < {$time}") or die(mysql_error());
while ($transaction = mysql_fetch_assoc($transactions)) {
$city = new city($transaction['destination']);
if ($city->getValue('user')->getValue('userid') == $transaction['user_id']) {
//if this is a friendly transfer
$city->setValue('unit_' . $transaction['unit_id'], $transaction['unit_count'], true);
} else {
//battle
$unit_data = mysql_query("SELECT function FROM units WHERE unit_id=" . $transaction['unit_id'], $db) or die(mysql_error());
$unit_data = mysql_fetch_assoc($unit_data);
unit_functions::$unit_data['function']($transaction, $city, $db);
}
//end if-else user == user
}
//end while transaction
mysql_query("DELETE FROM server_unit_transaction WHERE eta < {$time}") or die(mysql_error());
$transactions = mysql_query("SELECT city_id,building_id FROM server_building_transaction WHERE eta < {$time}") or die(mysql_error());
while ($transaction = mysql_fetch_assoc($transactions)) {
$city = new city($transaction['city_id']);
$city->finish_build($transaction['building_id']);
}