本文整理汇总了PHP中FileUtil::fileSockOpen方法的典型用法代码示例。如果您正苦于以下问题:PHP FileUtil::fileSockOpen方法的具体用法?PHP FileUtil::fileSockOpen怎么用?PHP FileUtil::fileSockOpen使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FileUtil
的用法示例。
在下文中一共展示了FileUtil::fileSockOpen方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionGetSecurity
public function actionGetSecurity()
{
if (Ibos::app()->getRequest()->getIsAjaxRequest()) {
$return = FileUtil::fileSockOpen(self::SECURITY_URL, 0, "charset=" . CHARSET);
$this->collect();
$this->ajaxReturn($return, "EVAL");
}
}
示例2: actionSetup
public function actionSetup()
{
$formSubmit = EnvUtil::submitCheck("smsSubmit");
if ($formSubmit) {
if (isset($_POST["enabled"])) {
$enabled = 1;
} else {
$enabled = 0;
}
$interface = $_POST["interface"];
$setup = $_POST["interface" . $interface];
Setting::model()->updateSettingValueByKey("smsenabled", (int) $enabled);
Setting::model()->updateSettingValueByKey("smsinterface", (int) $interface);
Setting::model()->updateSettingValueByKey("smssetup", $setup);
CacheUtil::update(array("setting"));
$this->success(Ibos::lang("Save succeed", "message"));
} else {
$data = array();
$smsLeft = 0;
$arr = Setting::model()->fetchSettingValueByKeys("smsenabled,smsinterface,smssetup");
$arr["smssetup"] = unserialize($arr["smssetup"]);
if (is_array($arr["smssetup"])) {
if ($arr["smsinterface"] == "1") {
$accessKey = $arr["smssetup"]["accesskey"];
$secretKey = $arr["smssetup"]["secretkey"];
$url = "http://sms.bechtech.cn/Api/getLeft/data/json?accesskey={$accessKey}&secretkey={$secretKey}";
$return = FileUtil::fileSockOpen($url);
if ($return) {
$return = json_decode($return, true);
if (isset($return["result"])) {
$smsLeft = $return["result"];
}
}
}
}
$temp = Setting::model()->fetchSettingValueByKey("");
$arr["setup"] = unserialize($temp);
$data["setup"] = $arr;
$data["smsLeft"] = $smsLeft;
$this->render("setup", $data);
}
}
示例3: checkUpgrade
public function checkUpgrade()
{
$return = false;
$upgradeFile = $this->upgradeurl . $this->versionPath() . "/" . IBOS_RELEASE . "/upgrade.xml";
$xmlContents = FileUtil::fileSockOpen($upgradeFile);
$response = XmlUtil::xmlToArray($xmlContents);
if (isset($response["cross"]) || isset($response["patch"])) {
Setting::model()->updateByPk("upgrade", array("value" => serialize($response)));
$return = true;
} else {
Setting::model()->updateByPk("upgrade", array("value" => ""));
$return = false;
}
$setting = Yii::app()->setting->get("setting");
$setting["upgrade"] = isset($response["cross"]) || isset($response["patch"]) ? $response : array();
Yii::app()->setting->set("setting", $setting);
return $return;
}
示例4: downloadFile
public static function downloadFile($upgradeInfo, $file, $folder = "upload", $md5 = "", $position = 0, $offset = 0)
{
$dir = PATH_ROOT . "/data/update/IBOS" . $upgradeInfo["latestversion"] . " Release[" . $upgradeInfo["latestrelease"] . "]/";
FileUtil::makeDirs(dirname($dir . $file));
$downloadFileFlag = true;
if (!$position) {
$mode = "wb";
} else {
$mode = "ab";
}
$fp = fopen($dir . $file, $mode);
if (!$fp) {
return false;
}
$tempUploadFileUrl = self::UPGRADE_URL . $upgradeInfo["latestversion"] . "/" . $upgradeInfo["latestrelease"] . "/" . self::$locale . "/" . $folder . "/" . $file . ".sc";
$response = FileUtil::fileSockOpen($tempUploadFileUrl, $offset, "", "", false, "", 15, true, "URLENCODE", false, $position);
if ($response) {
if ($offset && strlen($response) == $offset) {
$downloadFileFlag = false;
}
fwrite($fp, $response);
}
fclose($fp);
if ($downloadFileFlag) {
$compare = md5_file($dir . $file);
if ($compare == $md5) {
return 2;
} else {
return 0;
}
} else {
return 1;
}
}