내 패키지에 파일이 있어야합니다. file1.json
{
"web" : "https://gmail.com",
"login" : "[email protected]",
"password" : "password",
}
file2.js
이 두 파일이 하나의 패키지에있는 동안 내 코드 (예 : 암호)의 .json 파일에서 데이터를 검색하고 싶습니다. 비밀번호 값을 가져 오려면 어떻게 해야합니까? 이것을 위해 jquery를 사용할 수 있습니까?
미리 감사드립니다
패키지 란 무엇을 의미합니까? Node.JS 인 경우 다음을 사용 require
하거나 가져올 수 있습니다 .
// 0 standard require
const { password } = require('./file')
// 1 the most concise way
import { password } from './file'
// 2 works with json also
import { password } from './file.json'
// 3 might also need to import default object
import file from './file'
const password = file.password
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다