我有一个项目,我正在努力,我刚刚切换到PHPStorm因为它开始变大,我需要一些重构工具.我注意到,由于变量未被声明为类型(就像它们在Java中一样),PHPStorm有时不知道在哪里查找变量名的方法调用.这是我的代码.
<?php
require_once "autoloader.php";
class User {
private $userID;
private $email;
private $encryptedPassword;
private $userDBWriter;
private $company;
private $companyInfoChangeRequest;
private $admin;
private $accountIsActive;
private $dealTracker;
private $changeRequestPending;
function __construct($email, $encryptedPassword) {
$this->email = $email;
$this->encryptedPassword = $encryptedPassword;
$this->userDBWriter = new UserDBWriter();
$this->admin = false;
$this->dealTracker = new DealTracker($this);
}
public function addUserToDB() {
$this->userDBWriter->addUserToDB($this);
}
public function setUserAsAdmin($adminStatus) {
$this->admin = (bool) $adminStatus;
}
public function userAccountActiveStatus($accountStatus) {
$this->accountIsActive = (bool) $accountStatus;
}
public function setUserID($userID) {
$this->userID = $userID; …Run Code Online (Sandbox Code Playgroud) 我正在使用Java Scanner.
我有一个.txt文件,其中保存了此文本.
PriceDB = {
["profileKeys"] = {
["Name - ???"] = "Name - ???",
},
["char"] = {
["Name - ???"] = {
["CurrentValue"] = "????|cffffffff70,197|TInterface\\MoneyFrame\\UI-GoldIcon:0:0:2:0|t|r",
},
},
}
Run Code Online (Sandbox Code Playgroud)
所有我想要做的就是打开这个文件,扫描仪和提取"CurrentValue"的70,197从该文件并将其保存为一个int.然而,每次打开文件时也不会读取一行,并抛出一个NoSuchElementException与"No line found"作为消息.在摆弄文件并逐一删除一些汉字后,我把它缩小到这个小家伙口.出于某种原因,扫描仪不喜欢这个角色.我只是想知道是否有一些我需要更改的编码设置,或者我是否会使用BufferedReader或者什么......我真的不确定发生了什么,除了我猜有编码错误.那么这里发生了什么?
编辑:这是我的扫描仪的初始化.
Scanner scanner;
if (region.equals("US")) {
scanner = new Scanner(new File("C:\\Program Files\\World of Warcraft\\WTF\\Account\\313023286#1\\SavedVariables\\WoWTokenPrice.lua"));
} else if (region.equals("EU")) {
scanner = new Scanner(new File("C:\\Program Files\\World of Warcraft\\WTF\\Account\\313495228#1\\SavedVariables\\WoWTokenPrice.lua"));
} else if (region.equals("China")) {
File file = …Run Code Online (Sandbox Code Playgroud)