• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP create函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中create函数的典型用法代码示例。如果您正苦于以下问题:PHP create函数的具体用法?PHP create怎么用?PHP create使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了create函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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');
 }
开发者ID:wilsonwp,项目名称:futbol_backend,代码行数:13,代码来源:TecnicosController.php


示例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);
         }
     }
 }
开发者ID:alencarmo,项目名称:OCF,代码行数:32,代码来源:clonecat.php


示例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));
 }
开发者ID:Gamepay,项目名称:xp-framework,代码行数:7,代码来源:PatternLayoutTest.class.php


示例4: draw

function draw($points)
{
    $xy = getXY($points);
    $map = getMap($xy['x'], $xy['y']);
    $set = getSet($points, $xy['x']);
    create($map, $set, $xy['x']);
}
开发者ID:bug1024,项目名称:doc,代码行数:7,代码来源:cli-bar.php


示例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();
     });
 }
开发者ID:swath2,项目名称:haven,代码行数:30,代码来源:2014_10_12_000000_create_users_table.php


示例6: getStream

 private function getStream()
 {
     if (!$this->stream) {
         $this->stream = create(safe_open($this->filename, $this->mode));
     }
     return $this->stream;
 }
开发者ID:davidsoloman,项目名称:drupalconsole.com,代码行数:7,代码来源:LazyOpenStream.php


示例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);
 }
开发者ID:melogamepay,项目名称:xp-framework,代码行数:29,代码来源:CipheringZipFileOutputStream.class.php


示例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());
}
开发者ID:jeremyadoux,项目名称:hhvm,代码行数:26,代码来源:generator_vars.php


示例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>()');
 }
开发者ID:xp-lang,项目名称:compiler,代码行数:17,代码来源:CompilationTask.class.php


示例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 . ')');
     }
 }
开发者ID:melogamepay,项目名称:xp-framework,代码行数:8,代码来源:LocaleNegotiatorTest.class.php


示例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#')));
 }
开发者ID:Gamepay,项目名称:xp-framework,代码行数:8,代码来源:ArrayTest.class.php


示例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);
 }
开发者ID:Gamepay,项目名称:xp-contrib,代码行数:15,代码来源:JiraClientRest2Protocol.class.php


示例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;
 }
开发者ID:kayandrae,项目名称:icicle,代码行数:15,代码来源:functions.php


示例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);
     }
 }
开发者ID:mrxotey,项目名称:icicle,代码行数:18,代码来源:functions.php


示例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;
 }
开发者ID:melogamepay,项目名称:xp-framework,代码行数:18,代码来源:AbstractUrlHandler.class.php


示例16: setUp

 /**
  * Sets up test case and backups Console::$err stream.
  *
  */
 public function setUp()
 {
     $this->cat = create(new LogCategory('default'))->withAppender(create(new ConsoleAppender())->withLayout(newinstance('util.log.Layout', array(), '{
     public function format(LoggingEvent $event) {
       return implode(" ", $event->getArguments());
     }
   }')));
     $this->stream = Console::$err->getStream();
 }
开发者ID:melogamepay,项目名称:xp-framework,代码行数:13,代码来源:ConsoleAppenderTest.class.php


示例17: up

 /**
  * Run the migrations.
  *
  * @return void
  */
 public function up()
 {
     Schema:
     create('tags', function (Blueprint $table) {
         $table->increments('id');
         $table->string('value');
         $table->timestamps();
     });
 }
开发者ID:paruljoshi,项目名称:Programming-Assignments,代码行数:14,代码来源:2016_02_15_210414_create_tags_table.php


示例18: setUp

 /**
  * Sets up test case
  */
 public function setUp()
 {
     $this->events = create('new util.collections.Vector<string>()');
     $appender = newinstance(Appender::class, [$this->events], ['events' => null, '__construct' => function ($events) {
         $this->events = $events;
     }, 'append' => function (LoggingEvent $event) {
         $this->events[] = $this->layout->format($event);
     }]);
     $this->fixture = (new LogCategory('default'))->withAppender($appender->withLayout(new PatternLayout('[%l] %m')));
 }
开发者ID:xp-framework,项目名称:logging,代码行数:13,代码来源:LogAppenderTest.class.php


示例19: driver

 /**
  * @param \Icicle\File\Driver|null $driver
  *
  * @return \Icicle\File\Driver
  */
 function driver(Driver $driver = null) : Driver
 {
     static $instance;
     if (null !== $driver) {
         $instance = $driver;
     } elseif (null === $instance) {
         $instance = create();
     }
     return $instance;
 }
开发者ID:sternt,项目名称:filesystem,代码行数:15,代码来源:functions.php


示例20: main

function main()
{
    $resp = array();
    if (isset($_POST['submit'])) {
        $productData = array('product_name' => isset($_POST['product_name']) ? $_POST['product_name'] : null, 'category_id' => isset($_POST['product_category']) ? (int) $_POST['product_category'] : null, 'product_is_saleable' => isset($_POST['product_is_saleable']) ? (int) $_POST['product_is_saleable'] : null, 'product_price' => isset($_POST['product_price']) ? (int) $_POST['product_price'] : null, 'product_stock' => isset($_POST['product_stock']) ? (int) $_POST['product_stock'] : null, 'product_brand' => isset($_POST['product_brand']) ? (int) $_POST['product_brand'] : null, 'product_gender' => isset($_POST['product_gender']) ? (int) $_POST['product_gender'] : null, 'product_color' => isset($_POST['product_color']) ? $_POST['product_color'] : null, 'product_cloth_type' => isset($_POST['product_cloth_type']) ? $_POST['product_cloth_type'] : null, 'product_made_in' => isset($_POST['product_made_in']) ? (int) $_POST['product_made_in'] : null, 'product_description' => isset($_POST['product_description']) ? $_POST['product_description'] : null);
        //TODO implement dedicated validation checks for every piece of data rather than following simple test
        $dataIsCorrect = true;
        foreach ($productData as $pieceOfData) {
            if (is_null($pieceOfData)) {
                addMessage('اطلاعات محصول به درستی وارد نشده است', FAILURE);
                $dataIsCorrect = false;
                break;
            }
        }
        // Handling product picture
        $pictureHandlingResult = handleProductPictureUpload();
        if (is_string($pictureHandlingResult)) {
            $productData['product_picture_name'] = $pictureHandlingResult;
        }
        if ($dataIsCorrect && $pictureHandlingResult !== false && create('products', $productData)) {
            addMessage(sprintf('"%s" با موفقیت ایجاد شد', htmlentities($productData['product_name'], ENT_QUOTES, 'UTF-8')), SUCSESS);
            return array('redirect' => BASE_URL . 'admin/product/list.php');
        } elseif ($dataIsCorrect) {
            addMessage('خطا در ذخیره سازی محصول', FAILURE);
        }
    }
    $tempCategories = listRecords('categories');
    $categories = array();
    foreach ($tempCategories as $category) {
        $categories[$category['id']] = $category['category_name'];
    }
    //TODO consider a table or config file for country
    $tempCountries = listRecords('countries');
    $countries = array();
    foreach ($tempCountries as $country) {
        $countries[$country['id']] = $country['country_name'];
    }
    /*
     * Load Brands
     */
    $tempBrands = listRecords('brands');
    $brands = array();
    foreach ($tempBrands as $brand) {
        $brands[$brand['id']] = $brand['brand_name'];
    }
    //TODO consider a table for OS
    //    $oses=array(
    //        1=>'Windows',
    //        2=>'Android',
    //        3=>'IOS',
    //        4=>'Linux'
    //    );
    $resp['data'] = array('categories' => $categories, 'brands' => $brands, 'countries' => $countries, 'productData' => isset($productData) ? $productData : array());
    return $resp;
}
开发者ID:mshahmalaki,项目名称:tahlildadeh-shop,代码行数:55,代码来源:edit.php



注:本文中的create函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP createCategory函数代码示例发布时间:2022-05-24
下一篇:
PHP cr_find_post_type函数代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap