我想确保路径中的每个文件夹都存在。
$Path = "NamFdr1/NamFdr2/NamFdr3/NamImj.jpg"
E.g:
"NamFdr1"
是否存在,如果不存在,"NamFdr2"
是否存在,如果没有创建;等等。如何使用内置函数执行此操作?
答案 0 :(得分:1)
试试这个,
DROP TABLE IF EXISTS books;
CREATE TABLE books
(id INT NOT NULL AUTO_INCREMENT PRIMARY KEY
,name VARCHAR(50) NOT NULL
,FULLTEXT(name)
) ENGINE = MyISAM;
INSERT INTO books VALUES
(1,'Me Before You'),
(2,'How To Win Friends...'),
(3,'The Girl on the Train'),
(4,'After You'),
(5,'We Were Liars');
DROP TABLE IF EXISTS tags;
CREATE TABLE tags
(id INT NOT NULL AUTO_INCREMENT PRIMARY KEY
,tag VARCHAR(20) NOT NULL
);
INSERT INTO tags VALUES
(1,'romance'),
(2,'thriller'),
(3,'fantasy'),
(4,'science fiction'),
(5,'drama'),
(6,'friends');
DROP TABLE IF EXISTS books_tags;
CREATE TABLE books_tags
(book_id INT NOT NULL
,tag_id INT NOT NULL
,PRIMARY KEY(book_id,tag_id)
);
INSERT INTO books_tags VALUES
(1,1),
(1,3),
(2,3),
(3,3),
(3,5),
(4,1),
(4,5),
(4,6),
(5,2),
(5,6);
我希望它会有所帮助