mkdir():参数无效

时间:2017-03-19 11:29:35

标签: php xampp mkdir invalid-argument

我尝试在PHP脚本中使用import random import time from keras.models import Sequential from keras.layers import Dense from keras import backend as K import tracemalloc def run(): tracemalloc.start() num_input_nodes = 12 num_hidden_nodes = 8 num_output_nodes = 1 random_numbers = random.sample(range(1000), 50) train_x, train_y = create_training_dataset(random_numbers, num_input_nodes) for i in range(100): snapshot = tracemalloc.take_snapshot() for j in range(10): start_time = time.time() nn = Sequential() nn.add(Dense(num_hidden_nodes, input_dim=num_input_nodes, activation='relu')) nn.add(Dense(num_output_nodes)) nn.compile(loss='mean_squared_error', optimizer='adam') nn.fit(train_x, train_y, nb_epoch=300, batch_size=2, verbose=0) K.clear_session() print("Iteration {iter}. Current time {t}. Took {elapsed} seconds". format(iter=i*10 + j + 1, t=time.strftime('%H:%M:%S'), elapsed=int(time.time() - start_time))) top_stats = tracemalloc.take_snapshot().compare_to(snapshot, 'lineno') print("[ Top 5 differences ]") for stat in top_stats[:5]: print(stat) def create_training_dataset(dataset, input_nodes): """ Outputs a training dataset (train_x, train_y) as numpy arrays. Each item in train_x has 'input_nodes' number of items while train_y items are of size 1 :param dataset: list of ints :param input_nodes: :return: (numpy array, numpy array), train_x, train_y """ data_x, data_y = [], [] for i in range(len(dataset) - input_nodes - 1): a = dataset[i:(i + input_nodes)] data_x.append(a) data_y.append(dataset[i + input_nodes]) return numpy.array(data_x), numpy.array(data_y) run() 创建文件夹 在mkdir()的位置,我有一个名为&#34的文件夹;详细信息"。在该文件夹中,我想创建另一个文件夹。

我使用此代码:

file.php

但我总是得到这个警告:

  

警告:mkdir(): 40 > \ Users \ Lenovo \ xampp \ htdocs \ public_html \ file.php 中的参数无效

我通过回复来检查mkdir("details/$id", 0777, true); 是否为空。

如何在详细信息文件夹下创建$id名称的文件夹?

1 个答案:

答案 0 :(得分:0)

您不能在字符串中使用$ id,必须将其连接起来

mkdir("details/". $id, 0777, true);
OR
mkdir("details/{$id}", 0777, true);