我有一个文件link.php 我想解码任何链接 link.php?u = aHR0cHM6Ly9vcGVubG9hZC5jby9lbWJlZC9QWTZ1al9sSElmQS9Fbl9l =
请咨询
答案 0 :(得分:0)
首先,您需要检索该值。做到这一点的基本方法是:
class ViewController: UIViewController, UICollectionViewDataSource, UITextFieldDelegate {
@IBOutlet weak var collectionView: UICollectionView!
var arr = [String]() //Original Array
var dataSourceArr = arr //Filtered array based on textField content
func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
return dataSourceArr.count
}
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "cell", for: indexPath)
return cell
}
func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool {
self.reload(textField)
return true
}
func reload(_ textField: UITextField) {
if let text = textField.text {
dataSourceArr = self.arr.filter({ $0.hasPrefix(text) }).sorted()
collectionView.reloadData()
}
}
}
然后您将需要解码该值。
$u = $_GET['u'];
$ u_decoded现在将具有$ u的解码值。请记住,此代码假定url中始终存在“ u”,并且始终使用base64编码。
您可以将这段代码缩短为...
$u_decoded = base64_decode($u);