本文整理汇总了PHP中fr函数的典型用法代码示例。如果您正苦于以下问题:PHP fr函数的具体用法?PHP fr怎么用?PHP fr使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了fr函数的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: readJsonsFile
function readJsonsFile($file)
{
// It's dead, jim? TODO: FIXME: IMPORTANT?
// Reads file, strips comments and other non-json stuff, json_decodes it -> Returns a json STRING not an object
$jsons = fr($file);
if (!$jsons) {
return false;
}
$linebreaks = goFigureLinebreaks($jsons);
$jsonslines = explode($linebreaks, $jsons);
$newjsonslines = array();
foreach ($jsonslines as $linenum => $line) {
// remove comments > everything after // is removed
$comment_pos = strpos($line, "//");
if ($comment_pos !== FALSE) {
$line = substr($line, 0, $comment_pos);
$line = str_replace(" ", " ", $line);
if ($line == "" || $line == " ") {
continue;
}
}
// remove/skip tabs
$line = str_replace("\t", "", $line);
// remove/skip empty lines
$line = str_replace(" ", " ", $line);
if (!$line) {
continue;
}
// store line
$newjsonslines[] = $line;
}
$newjsons = implode($linebreaks, $newjsonslines);
return $newjsons;
}
开发者ID:FXDigitalNetworks,项目名称:icerrr,代码行数:34,代码来源:s.functions.php
示例2: sqldumptable
function sqldumptable($table, $fp = 0)
{
$tabledump = "DROP TABLE IF EXISTS {$table};\n";
$tabledump .= "CREATE TABLE {$table} (\n";
$firstfield = 1;
$fields = q("SHOW FIELDS FROM {$table}");
while ($field = mysql_fetch_array($fields)) {
if (!$firstfield) {
$tabledump .= ",\n";
} else {
$firstfield = 0;
}
$tabledump .= " {$field['Field']} {$field['Type']}";
if (!empty($field["Default"])) {
$tabledump .= " DEFAULT '{$field['Default']}'";
}
if ($field['Null'] != "YES") {
$tabledump .= " NOT NULL";
}
if ($field['Extra'] != "") {
$tabledump .= " {$field['Extra']}";
}
}
fr($fields);
$keys = q("SHOW KEYS FROM {$table}");
while ($key = mysql_fetch_array($keys)) {
$kname = $key['Key_name'];
if ($kname != "PRIMARY" && $key['Non_unique'] == 0) {
$kname = "UNIQUE|{$kname}";
}
if (!is_array($index[$kname])) {
$index[$kname] = array();
}
$index[$kname][] = $key['Column_name'];
}
fr($keys);
while (list($kname, $columns) = @each($index)) {
$tabledump .= ",\n";
$colnames = implode($columns, ",");
if ($kname == "PRIMARY") {
$tabledump .= " PRIMARY KEY ({$colnames})";
} else {
if (substr($kname, 0, 6) == "UNIQUE") {
$kname = substr($kname, 7);
}
$tabledump .= " KEY {$kname} ({$colnames})";
}
}
$tabledump .= "\n);\n\n";
if ($fp) {
fwrite($fp, $tabledump);
} else {
echo $tabledump;
}
$rows = q("SELECT * FROM {$table}");
$numfields = mysql_num_fields($rows);
while ($row = mysql_fetch_array($rows)) {
$tabledump = "INSERT INTO {$table} VALUES(";
$fieldcounter = -1;
$firstfield = 1;
while (++$fieldcounter < $numfields) {
if (!$firstfield) {
$tabledump .= ", ";
} else {
$firstfield = 0;
}
if (!isset($row[$fieldcounter])) {
$tabledump .= "NULL";
} else {
$tabledump .= "'" . mysql_escape_string($row[$fieldcounter]) . "'";
}
}
$tabledump .= ");\n";
if ($fp) {
fwrite($fp, $tabledump);
} else {
echo $tabledump;
}
}
fr($rows);
if ($fp) {
fwrite($fp, "\n");
} else {
echo "\n";
}
}
开发者ID:mcanv,项目名称:webshell,代码行数:86,代码来源:2009mssql.php
示例3: header
<?php
include "../s.functions.php";
header("Content-Type: text/plain");
header("Access-Control-Allow-Origin: *");
$fr = fr("log.txt");
echo $fr;
开发者ID:rejhgadellaa,项目名称:icerrr,代码行数:7,代码来源:log.php
示例4: json_encode
$jsons = json_encode($json);
$fw = fw($path_jsons, $jsons);
// auth json..
$path_auth_jsons = "data/data_authkeys.json";
// check vars
if (!$nfcpyr_id) {
error("_GET[nfcpyr_id] not provided");
}
if (!$nfcpyr_user) {
error("_GET[nfcpyr_user] not provided");
}
if (!$nfcpyr_pass) {
error("_GET[nfcpyr_pass] not provided");
}
// get json
$jsons = fr($path_auth_jsons);
if (!$jsons) {
$jsons = "[]";
}
$json = json_decode($jsons, true);
// -> find user + id
foreach ($json as $entry) {
if ($entry["id"] == $nfcpyr_id && $entry["user"] == $nfcpyr_user) {
error("Authkey for user and/or id already exists");
}
}
// do
$newentry = array();
$newentry["id"] = $nfcpyr_id;
$newentry["user"] = $nfcpyr_user;
$newentry["pass"] = $nfcpyr_pass;
开发者ID:rejhgadellaa,项目名称:nfcpyr,代码行数:31,代码来源:api.php
示例5: sqldumptable
function sqldumptable($table, $fp = 0)
{
global $mysqllink;
$tabledump = "DROP TABLE IF EXISTS `{$table}`;\n";
$res = q("SHOW CREATE TABLE {$table}");
$create = mysql_fetch_row($res);
$tabledump .= $create[1] . ";\n\n";
if ($fp) {
fwrite($fp, $tabledump);
} else {
echo $tabledump;
}
$tabledump = '';
$rows = q("SELECT * FROM {$table}");
while ($row = mysql_fetch_assoc($rows)) {
foreach ($row as $k => $v) {
$row[$k] = "'" . @mysql_real_escape_string($v) . "'";
}
$tabledump = 'INSERT INTO `' . $table . '` VALUES (' . implode(", ", $row) . ');' . "\n";
if ($fp) {
fwrite($fp, $tabledump);
} else {
echo $tabledump;
}
}
fwrite($fp, "\n\n");
fr($rows);
}
开发者ID:evil7,项目名称:webshell,代码行数:28,代码来源:z7.php
示例6: fr
<?php
include "s.functions.php";
// Read data
$jsons = fr("../../api/data/analytics.json");
$json = json_decode($jsons, true);
$data = array();
$data["byid"] = array();
$data["byversion"] = array();
$data["bymodel"] = array();
$data["byplatform"] = array();
$data["installgraph"] = array();
foreach ($json as $jsonk => $jsonv) {
$newid = false;
// By id
$id = $jsonv["id"];
if (!$data["byid"][$id]) {
$data["byid"][$id] = $jsonv;
$data["byid"][$id]["entries"] = 1;
$newid = true;
} else {
$data["byid"][$id]["entries"]++;
}
// By version
$version = $jsonv["app_version"];
if (!$data["byversion"][$version]) {
$data["byversion"][$version] = array();
$data["byversion"][$version]["ids"][] = $id;
$data["byversion"][$version]["datas"][] = $jsonv;
$data["byversion"][$version]["entries"] = 1;
} else {
开发者ID:FXDigitalNetworks,项目名称:icerrr,代码行数:31,代码来源:index.php
示例7: fr
break;
case "station_icon":
// NOTE: does not return json, it returns http responses! // TODO: yes?
$filename = $_FILES['file']['name'];
$filepath = "../static/uploaded/{$filename}";
$filetmp = $_FILES['file']['tmp_name'];
/*
// redundant check. this is easily faked..
$postkey = $_POST["key"];
$getkey = $queryobj["key"];
if ($postkey!=$getkey) {
http_response_code(403);
error("Access denied'");
}
/**/
$devicess = fr("data/deviceids.json");
$devices = json_decode($devicess, true);
if (!in_array($queryobj["device"], $devices)) {
http_response_code(403);
error("Access denied'");
}
$moved = move_uploaded_file($filetmp, $filepath);
if (!$moved) {
http_response_code(500);
error("Could not move file '{$filetmp}' to '{$filepath}'");
} else {
http_response_code(200);
echo json_encode(array("info" => array(), "data" => array("post" => "ok", "filename" => $filename)));
}
break;
// default
开发者ID:rejhgadellaa,项目名称:icerrr,代码行数:31,代码来源:api.php
示例8: date
if ($lastdevice != $deviceId) { $res .= "<tr><td> </td></tr>\n\n"; $newdevice = true; }
$lastdevice = $deviceId;
// Find device name
foreach ($byDeviceId as $file) {
$path = "html/".$file;
$filemtime = @filemtime($path);
$date = date("Y-m-d H:i:s",$filemtime);
$date_short = date("m-d H:i",$filemtime);
if ($newdevice) {
$fr = fr($path);
$lines = explode("\n",$fr);
foreach($lines as $line) {
if (strpos($line,"Device Info")!==FALSE) {
break;
}
}
}
$res .= "<tr><td>{$date_short} </td><td><a title='$date' href='{$path}'>$file</a></td><td> {$line}</td></tr>\n";
$newdevice = false;
}
开发者ID:keloxers,项目名称:icerrr,代码行数:30,代码来源:read.php
示例9: substr
$force = $_GET["force"]; // ignore errors;
// ----------------------------------------------------------------------------
// File name + extension
$imgName = substr($imgFile, strrpos($imgFile,"/")+1);
$imgSrcExtension = strtolower(substr($imgFile, strrpos($imgFile,".")+1));
// Check Cache
if ($cfg["cacheEnabled"]) {
// Check if image is available from cache, if so: show it
$imgCache = cache_load($imgFile, $thWidth, $thHeight);
if ($imgCache) { //header("location: $imgCache");
$content = fr($imgCache);
if (strtolower($imgSrcExtension)=="jpg") { $type = "jpeg"; }
else { $type = strtolower($imgSrcExtension); }
header("Content-Disposition: filename=\"{$imgName}\"");
header("Content-type: image/{$type}");
echo $content;
setIdle();
die();
}
}
// Handle if image is located on remote server
if ($imgIsRemote) {
// It is: attempt to download to local server
开发者ID:keloxers,项目名称:icerrr,代码行数:30,代码来源:rgthumb.php
示例10: fr
fr('First Name', '<input type="text" name="first_name" value="" size="50" maxlength="60" />', 'Enter your first name. Maximum 20 characters.');
fr('Last Name', '<input type="text" name="last_name" value="" size="50" maxlength="60" />', 'Enter your last name. Maximum 20 characters.');
fr('Contact Phone Number', '<input type="text" name="phone" value="" size="30" maxlength="30" />', 'Enter a phone number where we can contact you, including your direct extensions.');
fr('Mailing Address', '<textarea name="addr" cols=50 rows=4></textarea>', 'Enter your mailing address here.');
fr('How did you hear about us?', '
<input type=radio name=hear value="participant" > Participated before<br>
<input type=radio name=hear value="deloitte" > Deloitte<br>
<input type=radio name=hear value="scholastic" > Scholastic<br>
<input type=radio name=hear value="card" > Holiday card<br>
<input type=radio name=hear value="press" > Press<br>
<input type=radio name=hear value="teacher" > Teacher<br>
<input type=radio name=hear value="friend" > Friend<br>
<input type=radio name=hear value="other"> Other (type into the box below)<br>
', 'Other: <input type=text name=hear_other size=50 axlength="255">');
fr('', ' ');
fr('', '<p><input type="submit" value="Next" alt="Continue"/>');
/*fr('', '<font color=#aa0000><b>
By clicking this button,
I agree that I will distribute the parental
consent form after I have registered all participants in the
Virtual Team Challenge.
</b></font><p><input type="submit" value="I Agree" alt="Continue"/>');*/
?>
</table>
</form>
<?php
}
?>
开发者ID:piter65,项目名称:spilldec,代码行数:30,代码来源:teachreg2.php
示例11: cache_log
function cache_log($txt)
{
if (file_exists("cache/cacheDbg.txt")) {
if (@filesize("cache/cacheDbg.txt") > 2 * 1024 * 1024) {
@unlink("cache/cacheDbg.txt");
cache_log("-- CLEAN LOG");
}
$log = fr("cache/cacheDbg.txt");
}
$log = date("Y-m-d H:i:s") . " :: {$txt}\r\n" . $log;
fw("cache/cacheDbg.txt", $log);
}
开发者ID:rejhgadellaa,项目名称:icerrr,代码行数:12,代码来源:rgt.functions.cache.php
示例12: filemtime
//$json["data"] = json_decode($json["data"],true);
$json["info"]["last_update_time_ms"] = filemtime($filename)*1000; // TODO: More info?
$json["info"]["last_update_timeago_sec"] = time() - filemtime($filename);
$json["info"]["last_update_date"] = date("Y-m-d H:i:s",filemtime($filename));
$json["info"]["desc"] = $queryobj["get"];
$jsons = json_encode($json);
$jsons = gzencode($jsons);
header('Content-Encoding: gzip');
echo $jsons;
break;
// station_nowplaying
case "station_nowplaying":
if (!$queryobj["station_id"]) { error("Error: 'station_id' not defined for get:station_info"); }
$filename = "../json/station_nowplaying.".$queryobj["station_id"].".json";
$json["data"] = fr($filename);
if (!$json["data"]) { error("Error: file '$filename' not found"); } // TODO: Generate file :D
//$json["data"] = json_decode($json["data"],true);
$json["info"]["last_update_time_ms"] = filemtime($filename)*1000; // TODO: More info?
$json["info"]["desc"] = $queryobj["get"];
$jsons = gzencode(json_encode($json));
header('Content-Encoding: gzip');
echo $jsons;
break;
// checkforupdates
case "checkforupdates":
if (!$queryobj["lookup"]) { error("Error: 'lookup' not defined for get:checkforupdates"); }
if (!$queryobj["last_update_time_ms"]) { error("Error: 'last_update_time_ms' not defined for get:checkforupdates"); }
if (!file_exists("../json/".$queryobj["lookup"].".json")) { error("Error: invalid lookup '".$queryobj["lookup"]."', file not found"); }
$filemtime_ms = @filemtime("../json/".$queryobj["lookup"].".json")*1000;
开发者ID:keloxers,项目名称:icerrr,代码行数:31,代码来源:api.php
示例13: array
<?php
include "s.functions.php";
$data_stations_urls = array();
$data_stations_urls_count = array();
$data_stations = array();
$data_station = array();
$device_ids = array();
$path_stations = "../../api/stations_users/";
$path_station = "../../api/station_users/";
$files_stations = rd($path_stations);
$files_station = rd($path_station);
// Get stations, remove duplicates
foreach ($files_stations as $file_stations) {
$jsons_stations = fr($path_stations . $file_stations);
$json_stations = json_decode($jsons_stations, true);
if (!$json_stations) {
continue;
}
$file_nameparts = explode("_", $file_stations);
$device_id = $file_nameparts[1];
foreach ($json_stations as $station) {
if (!in_array($station["station_url"], $data_stations_urls)) {
$data_stations_urls_count[$station["station_url"]]++;
$data_stations_urls[] = $station["station_url"];
$data_stations[] = $station;
$device_ids[] = $device_id;
} elseif (!in_array($device_id, $device_ids)) {
$data_stations_urls_count[$station["station_url"]]++;
}
}
开发者ID:FXDigitalNetworks,项目名称:icerrr,代码行数:31,代码来源:index.php
示例14: str_replace
}
$config .= "--cfgArrayName--[\"cfgArrayName\"] = \"{$cfgArrayName}\";\n";
$config .= "\n\n?>";
$config = str_replace("\n", "\r\n", $config);
$config = str_replace("--cfgArrayName--", "\${$cfgArrayName}", $config);
$config = stripslashes($config);
$fw = fw($configfile, $config);
if ($fw) {
header("location: rgConfigEdit.php?file={$configfile}");
} else {
die("Error accured?<br><a href='javascript:history.back(1)'>Back</a>");
}
die;
}
// ---------------------------------------------
$config = fr($configfile);
$strStart = 1;
$strEnd = 0;
$strLen = 0;
$whileInt = 0;
while ($strStart > 0) {
$key = "";
$val = "";
if ($strStart > strlen($config)) {
$strStart = -1;
continue;
}
$whileInt++;
if ($whileInt > 256) {
$strStart = -1;
continue;
开发者ID:FXDigitalNetworks,项目名称:icerrr,代码行数:31,代码来源:rgConfigEdit.php
注:本文中的fr函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论