【发布时间】:2019-06-14 18:36:08
【问题描述】:
我想在 Atom 中使用我自己的代码 sn-ps,但经过数小时的尝试,我仍然无法使用前两个以上的代码,而且我找不到错误。
当我在寻找解决方案时,我发现了很多很多主题,但每个主题的错误都是重复使用源范围,但这不是我的问题。实际上,我几乎尝试了所有方法,对语法进行了很多更改,但没有任何帮助。
".text.html.basic, .text.html.php":
"Include jQuery":
"prefix": "jquery"
"body": "<script src='https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js'></script>"
"Basic HTML structure":
"prefix": "start"
"body": '''
<!DOCTYPE html>
<html lang="cs">
<head>
<meta charset="utf-8">
<meta name="description" content="$1">
<meta name="author" content="MagicDev">
<meta name="keywords" content="$2">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" type="text/css" href="style.css">
<script src="script.js"></script>
<title>$3</title>
</head>
<body>
$4
</body>
</html>
'''
"DB Connection":
"prefix": "connection"
"body": '''
<?php
$servername = "$1";
$username = "$2";
$password = "$3";
$dbname = "$4";
$conn = new mysqli($servername, $username, $password, $dbname);
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
mysqli_query($conn, "set names utf8");
?>$5
'''
"DB Close Connection":
"prefix": "disconnection"
"body": "$conn->close();$1"
"DB Insert":
"prefix": "insert"
"body": '''
$sql = $conn->prepare("INSERT INTO ${1:"table"} (${2:"attributes"})
VALUES (${3:"?,?,?"})");
$sql->bind_param("${4:"ssi"}", ${5:"variablesToInsert"});
$sql->execute();
$sql->close();$6
'''
"Remove tags":
"prefix": "removeTags"
"body": "strip_tags($1)"
有人可以救我吗?我忽略了什么?
【问题讨论】:
标签: atom-editor code-snippets cson