我运行create-react-app然后切换到目录并运行npm start。只是想知道如何指定一个不同于index.js的文件来启动服务器
这是我的package.json文件:
$servername = "localhost";
$username = "-";
$password = "-";
$database = "-";
$link = mysqli_connect($servername, $username, $password, $database);
if (!$link) {
die(mysqli_error());
}
$sql = "SELECT UserClassName FROM UserInfo1 WHERE UserEmail = '". mysqli_real_escape_string($link, $_SESSION['useremail']) . "'";
if (!$sql) {
die(mysqli_error());
}
$result = mysqli_query($link, $sql);
if (!$result) {
die(mysqli_error());
}
?>
<script>
function getclassname() {
return document.getElementById("UserClassName").innerHTML = "<?php echo
$result ?>";
}
</script>
<html>
<body onload="getclassname(); getcurrentlevel();">
<h1 class="text-center" id="UserClassName" name="UserClassName"><b>Welcome Enviroquest Research Team!</b></h1>
</body>
</html>
我尝试过改变:
{
"name": "todo",
"version": "0.1.0",
"private": true,
"dependencies": {
"react": "^16.2.0",
"react-dom": "^16.2.0",
"react-scripts": "1.1.1"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject"
}
}
到
"start": "react-scripts start",
但那些不能工作
答案 0 :(得分:0)
查找并编辑 package.json 文件。例如:
{
"name": "build",
"version": "0.0.1",
"scripts": {
"start": "node different-file.js"
}
}