Пример #1
0
 /**
  * 
  * 生成licenseKey
  * @param string $domain
  * @param string $mac_addr
  * @param string $expire_date
  */
 public function createLicenseKey($domain, $mac_addr, $expire_date)
 {
     $text = $this->licenseText;
     $license_key_source = array('domain' => $domain, 'mac_addr' => $mac_addr, 'expire_date' => $expire_date, 'subcounts' => $subcounts, 'total_size' => $total_size, 'text' => $text);
     $license_key = $this->encode($license_key_source);
     file_put_content($this->licenseKeyPath, $license_key);
 }
Пример #2
0
 /**
  * Generates the document and outputs it to a file.
  * 
  * <p>Uses {@link file_put_content} when available. Includes a workaround 
  * for older versions of PHP.</p>
  * 
  * <p>Usage example:</p>
  * <code>
  * <?php
  * require "HTML/Page2.php";
  * $page = new HTML_Page2();
  * $page->setTitle('My Page');
  * $page->addBodyContent('<h1>My Page</h1>');
  * $page->addBodyContent('<p>First Paragraph.</p>');
  * $page->addBodyContent('<p>Second Paragraph.</p>');
  * $page->toFile('myPage.html');
  * ?>
  * </code>
  * 
  * @return  void
  * @since   2.0
  * @access  public
  */
 function toFile($filename)
 {
     if (function_exists('file_put_content')) {
         file_put_content($filename, $this->toHtml());
     } else {
         $file = fopen($filename, 'wb');
         fwrite($file, $this->toHtml());
         fclose($file);
     }
     if (!file_exists($filename)) {
         PEAR::raiseError("HTML_Page::toFile() error: Failed to write to {$filename}", 0, PEAR_ERROR_TRIGGER);
     }
 }
Пример #3
0
 /**
  * Generates CSS and stores it in a file.
  *
  * @return  void
  * @since   0.3.0
  * @access  public
  */
 function toFile($filename)
 {
     if (function_exists('file_put_content')) {
         file_put_content($filename, $this->toString());
     } else {
         $file = fopen($filename, 'wb');
         fwrite($file, $this->toString());
         fclose($file);
     }
     if (!file_exists($filename)) {
         return $this->raiseError(HTML_CSS_ERROR_WRITE_FILE, 'error', array('filename' => $filename));
     }
 }
Пример #4
0
            echo "failed";
        } else {
            echo "success with result {$result}";
        }
    } catch (Exception $e) {
        echo 'Caught exception: ', $e->getMessage(), "\n";
    }
    echo "END";
});
// END get
$app->post('/crud(/:ptype(/:payload(/:dataset(/:id))))', function ($ptype = no, $payload = no, $dataset = no, $id = no) {
    /*
    echo "Type: $ptype\n";
    echo "Payload: $payload\n";
    echo "dataset: $dataset\n";
    echo "id: $id\n";
    */
    $crudarray[] = array("type" => $ptype, "payload" => $payload, "dataset" => $dataset, "id" => $id);
    $data = '{"crud":' . json_encode($crudarray) . '}';
    $data2 = (string) $data;
    print $data;
    file_put_content('test.json', $data2);
});
// END post
/**
 * Step 4: Run the Slim application
 *
 * This method should be called last. This executes the Slim application
 * and returns the HTTP response to the HTTP client.
 */
$app->run();