报告错误:
致命错误语法错误,第3行意外'是'(T_STRING),期待','或')'
我的代码如下:
package RestClient;
import java.io.*;
import java.nio.Buffer;
import java.nio.channels.FileChannel;
import java.nio.channels.FileLock;
import java.nio.channels.OverlappingFileLockException;
public class Filelocking {
public static void main(String[] args) throws IOException {
String Name = "E:\\RestAPI\\Token.txt";
File File = new File(Name);
File FileRename = new File(Name);
boolean FileEdit = false;
if (!File.renameTo(FileRename)) {
while (!File.renameTo(FileRename)) {
System.out.println("rename failed");
if (File.renameTo(FileRename)) {
FileEdit = true;
break;
}
}
}
else {
FileEdit = true;
}
System.out.println("rename success");
if (FileEdit) {
RandomAccessFile AccessFile = new RandomAccessFile(File, "rw");
FileChannel channel = AccessFile.getChannel();
FileLock lock = null;
try {
lock = channel.lock();
System.out.println("Lock Status: " + lock.isValid());
BufferedReader read = new BufferedReader (new FileReader(File));
System.out.println( read.readLine());
}
catch (OverlappingFileLockException e) {
System.out.println("File Lock Error: " + e.getMessage());
}
lock.close();
}
}
}
我的目标是从mySQL中捕获字段,例如<?php
if(isset($_SESSION['id'])){
$id = $_SESSON['id'];
$sqlQuery = "SELECT * FROM * users WHERE id = :id";
$statement = $db->prepare($sqlQuery);
$statement->execute(array(':id' => $id));
while($rs = $statement->fetch()){
$username = $rs['username'];
$email = $rs['email'];
$date_joined = strftime("%b %d, %Y", strtotime($rs["join_date"]));
}
$encode_id = base64_encode("encodeuserid{$id}");
}
,email
,username
。