本文整理汇总了PHP中create函数的典型用法代码示例。如果您正苦于以下问题:PHP create函数的具体用法?PHP create怎么用?PHP create使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了create函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: store
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
Tecnico:
create($request->all());
Session::flash('message', 'Tecnico Creado con Exito');
Redirect::to('tecnicos');
}
示例2: cloneCategory
function cloneCategory($category, $sortId = 0)
{
$id = $category->id;
unset($category->id);
unset($category->creationtime);
unset($category->wholeName);
unset($category->permaLink);
$category->sortId = $sortId;
$category->subCatNum = $category->directSubCatNum = $category->itemNum = $category->directItemNum = 0;
if (!$this->withPictures) {
$category->picture = "";
}
$category->create(FALSE, TRUE);
// fromClone=TRUE
if ($this->withPictures && $category->picture) {
copy(CAT_PIC_DIR . "/{$id}.{$category->picture}", CAT_PIC_DIR . "/{$category->id}.{$category->picture}");
}
// Cloning the custom fields:
G::load($fields, array("SELECT * FROM @customfield WHERE cid=#cid#", $id));
foreach ($fields as $field) {
unset($field->id);
$field->cid = $category->id;
create($field);
}
if ($this->recursive) {
G::load($subCats, array("SELECT * FROM @category WHERE up=#id#", $id));
foreach ($subCats as $sc) {
$sc->up = $category->id;
$this->cloneCategory($sc, $sc->sortId);
}
}
}
示例3: tokenContext
public function tokenContext()
{
$context = new MappedLogContext();
$context->put('key1', 'val1');
$event = new LoggingEvent(new LogCategory('default', LogLevel::ALL, $context), 1258733284, 1, LogLevel::INFO, array('Hello'));
$this->assertEquals('key1=val1', create(new PatternLayout('%x'))->format($event));
}
示例4: draw
function draw($points)
{
$xy = getXY($points);
$map = getMap($xy['x'], $xy['y']);
$set = getSet($points, $xy['x']);
create($map, $set, $xy['x']);
}
示例5: up
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('users', function (Blueprint $table) {
$table->increments('id');
$table->string('first_name');
$table->string('last_name');
$table->string('password', 60);
$table->string('location_country');
$table->string('location_region');
$table->string('email')->unique();
$table->string('company');
$table->text('description');
$table->string('profile_picture');
$table->rememberToken();
$table->timestamps();
});
Schema:
create('project_user', function (Blueprint $table) {
$table->integer('project_id')->unsigned();
$table->foreign('project_id')->references('id')->on('projects')->onDelete('cascade');
$table->integer('user_id')->unsigned();
$table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
$table->timestamps();
});
}
示例6: getStream
private function getStream()
{
if (!$this->stream) {
$this->stream = create(safe_open($this->filename, $this->mode));
}
return $this->stream;
}
示例7: close
/**
* Close this buffer
*
*/
public function close()
{
if (NULL === $this->data) {
return;
}
// Already written
// Calculate CRC32
$crc32 = create(new CRC32($this->md->digest()))->asInt32();
// Create random bytes
$rand = '';
for ($i = 0; $i < 11; $i++) {
$rand .= chr(mt_rand(0, 255));
}
$preamble = $this->cipher->cipher($rand . chr($crc32 >> 24 & 0xff));
// Now cipher and the compress raw bytes
$compressed = new MemoryOutputStream();
$compression = $this->compression[0]->getCompressionStream($compressed, $this->compression[1]);
$compression->write($this->cipher->cipher($this->data->getBytes()));
$bytes = $compressed->getBytes();
// Finally, write header, preamble and bytes
$this->writer->writeFile($this->file, $this->size, strlen($bytes) + strlen($preamble), $crc32, 1);
$this->writer->streamWrite($preamble);
$this->writer->streamWrite($bytes);
delete($this->data);
}
示例8: main
function main()
{
dumpgen(create());
dumpgen(unusedarg(new logger(), 5));
dumpgen(getargs(1, 2, 3, 4, 5));
$g = genthrow();
try {
$g->next();
} catch (Exception $e) {
}
try {
$g->next();
} catch (Exception $e) {
var_dump($e->getMessage());
}
$g = manylocals();
$g->next();
var_dump($g->current());
$g->send(new stdclass());
var_dump($g->current());
$g->send($g);
var_dump($g->current());
$g->next();
var_dump($g->current());
var_dump($g->valid());
}
示例9: __construct
/**
* Constructor
*
* @param xp.compiler.io.Source source
* @param xp.compiler.diagnostic.DiagnosticListener listener
* @param xp.compiler.io.FileManager manager
* @param xp.compiler.emit.Emitter emitter
* @param util.collections.HashTable<xp.compiler.io.Source, xp.compiler.types.Types> done
*/
public function __construct(\xp\compiler\io\Source $source, \xp\compiler\diagnostic\DiagnosticListener $listener, \xp\compiler\io\FileManager $manager, \xp\compiler\emit\Emitter $emitter, $done = null)
{
$this->source = $source;
$this->manager = $manager;
$this->listener = $listener;
$this->emitter = $emitter;
$this->done = $done ?: create('new util.collections.HashTable<xp.compiler.io.Source, xp.compiler.types.Types>()');
}
示例10: languageNegotiation
public function languageNegotiation()
{
$supported = array('de_DE', 'en_UK', 'en_US', 'es_ES');
$default = 'en_US';
foreach (array('de_DE, en_UK' => 'de_DE', 'es_ES, de_DE' => 'es_ES', 'en_US' => 'en_US', 'fr_FR' => 'en_US', 'fr_FR, en_UK' => 'en_UK') as $usersetting => $result) {
$this->assertEquals(new Locale($result), create(new LocaleNegotiator($usersetting))->getLocale($supported, $default), 'Setting <' . $usersetting . '> should yield ' . $result . ' (supported: ' . implode(', ', $supported) . ', default: ' . $default . ')');
}
}
示例11: arrayOfStringToStringMultiple
public function arrayOfStringToStringMultiple()
{
$l = create('new net.xp_framework.unittest.core.generics.Lookup<string[], string>');
$l->put(array('red', 'green', 'blue'), 'colors');
$l->put(array('PHP', 'Java', 'C#'), 'names');
$this->assertEquals('colors', $l->get(array('red', 'green', 'blue')));
$this->assertEquals('names', $l->get(array('PHP', 'Java', 'C#')));
}
示例12: req
/**
* Issue a request
*
* @param string path The path
* @param mixed[] args The arguments
* @return webservices.rest.RestResponse
*/
protected function req($path, $args = array())
{
$req = create(new RestRequest())->withHeader('Authorization', new BasicAuthorization($this->url->getUser(), $this->url->getPassword()))->withResource(rtrim($this->url->getPath(), '/') . $path)->withMethod(HttpConstants::GET);
foreach ($args as $name => $value) {
$req->addParameter($name, $value);
}
return $this->con->execute($req);
}
示例13: loop
/**
* Returns the active event loop. Can be used to set the active event loop if the event loop has not been accessed.
*
* @param \Icicle\Loop\LoopInterface|null $loop
*
* @return \Icicle\Loop\LoopInterface
*/
function loop(LoopInterface $loop = null) : LoopInterface
{
static $instance;
if (null === $instance || null !== $loop) {
$instance = $loop ?: create();
}
return $instance;
}
示例14: with
/**
* Runs the tasks set up in the given function in a separate event loop from the default event loop. If the default
* is running, the default event loop is blocked while the separate event loop is running.
*
* @param callable $worker
* @param Loop|null $loop
*
* @return bool
*/
function with(callable $worker, Loop $loop = null) : bool
{
$previous = loop();
try {
return loop($loop ?: create())->run($worker);
} finally {
loop($previous);
}
}
示例15: sendErrorMessage
/**
* Send a HTTP error message
*
* @param peer.Socket socket
* @param int sc the status code
* @param string message status message
* @param string reason the reason
* @return int
*/
protected function sendErrorMessage(Socket $socket, $sc, $message, $reason)
{
$package = create(new \lang\XPClass(__CLASS__))->getPackage();
$errorPage = $package->providesResource('error' . $sc . '.html') ? $package->getResource('error' . $sc . '.html') : $package->getResource('error500.html');
$body = str_replace('<xp:value-of select="reason"/>', $reason, $errorPage);
$this->sendHeader($socket, $sc, $message, array('Content-Type' => 'text/html', 'Content-Length' => strlen($body)));
$socket->write($body);
return $sc;
}